0

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?

Severin
  • 8,508
  • 14
  • 68
  • 117

2 Answers2

0

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

Severin
  • 8,508
  • 14
  • 68
  • 117
0

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.

Priyanka Modi
  • 1,594
  • 1
  • 8
  • 14