WordPress HTTPS redirect loop

I’ve been struggling to get HTTPS functional on my site for over ten hours now. I’ve got severe headache trying to set it up myself. I want you to understand that I tried several different ways to solve and asking this amazing community only as a last resort. I would really appreciate if anyone could help me out.

The website is running on Apache and the conf file looks like this:

# 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]

RewriteCond %{HTTPS} off
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
# END WordPress

First Issue:
After these changes to the conf file, I tried to reload the website and it throws an error. A redirect loop.

Second issue:
When I change the site and home urls in the general settings screen to https:// from http://, it leads to a redirect loop.

I just don’t understand why these are happening. I tried different variations of htaccess rules. I played with the apache configurations. Nothing worked.

Let me know if you need any other information. All help is welcome. Thank you 🙂

2 s
2

I’v added $_SERVER['HTTPS'] = 'on'; to my wp-config.php as seen on WordPress wp-admin https redirect loop and it worked perfectly!

Leave a Comment