When I change the redirect https in my .htaccess the site returns the message “Too many redirects” loop.

This is the modified .htaccess

RewriteCond %{HTTPS} off
RewriteRule (.*)$ https://www.mywebsite.it/$1 [L,R=301]

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

# END WordPress

I also added in the wp-config.php:

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);

3 Answers
3

Adding redirect to htaccess in the way that you have done will not work without adjudicating the site url to be https as well. If it is http, you will get endless redirect due to wordpress detecting that you are trying to access a non canonical URL (the https), and will try to redirect you to the canonical one, which is based on the site url, which is http, and then the htacess will redirect to https again only for wordpress to redirect to http, and so on.

Leave a Reply

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