WordPress Force SSL

WordPress Force SSL

Papin Schipper on 17 May 2016

#ssl #wordpress

How to force WordPress to use SSL

When youre using SSL on your WordPress-powered website youll know that simply changing your websites url in the setting isnt enought, it will redirect the homepage to your HTTPS version, but when a user goes to example.com/blog it wont redirect to HTTPS, this can cause trouble with including stylesheets etc. Now, you can use a plugin to fix this but if youre like me and dont want to use plugin unless absolutely necessary you can do this yourself.

Simply add the following code to your .htaccess file will make it work.

# BEGIN WordPress
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
 RewriteRule ^index.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 # END WordPress

Alernative: Use a plugin

Ofcourse you can also use a plugin to do this for you, I myself use Really Simple SSL and would highly recommend it.


Leave a Reply

Your email address will not be published. Required fields are marked *

15 − 8 =