skip to Main Content

I’m currently working on a new WordPress Site and (ofc) want to redirect all HTTP traffic to HTTPS. They way I tried it is by defining this in my .htaccess

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

For the landingpage this works fine, but all posts are still accessible through HTTP without getting redirected. Any ideas why this could be happening?

2

Answers


  1. Chosen as BEST ANSWER

    Appareantly the order of the configs is important. When placing is at the very top of the .htaccess it worked as expected.


  2. Here, There are a couple different options you have when choosing to redirect HTTP to HTTPS in WordPress.

    • Redirect HTTP to HTTPS in Nginx

    E.g. Method for redirecting WordPress running on Nginx.

    server {
    listen 80;
    server_name domain.com www.domain.com;
    return 301 https://example.com$request_uri;
    }
    • Redirect HTTP to HTTPS in Apache

    E.g. Method for redirecting WordPress running on Apache.

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    • Redirect HTTP to HTTPS with Really Simple SSL Plugin

    E.g. The third option you have to redirect from HTTP to HTTPS is to use the free WordPress Really Simple SSL plugin.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search