I’ve done this many times before, and yet I’m not managing to do this again for some unknown reason. Tried endless solutions. Everything I’ve tried results in an endless redirect loop.
What is the best option for doing this?
Update 1
Here are a few of the things tried;
RewriteCond %{HTTP_HOST} ^website\.co\.uk [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.website.co.uk/$1 [R,L]
And;
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.website.co.uk$1 [R,L]
Tested in different browsers to prevent caching issues. Still nothing, just getting continual redirect loop.
I see, when you enter a link to your page other than your home, example:
http://www.michaelcropper.co.uk/contact-me
www.michaelcropper.co.uk/contact-me
michaelcropper.co.uk/contact-me
If https://
is not in the prefix, the HTTP link loads instead. Add the following into your .htaccess
in between the <IfModule mod_rewrite.c>
tag:
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
If there were no additional modifications done to your .htaccess
, it should look like the following:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Rewrite HTTP to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
# END WordPress
Let me know how it goes.