How to avoid multiple redirects?
-
Hello,
I am facing multiple redirects when typing https://www and it is using double redirects to reach to https://non-www. First it goes to https://www and then goes to the https://non-www version. I want to avoid the extra redirect.
So basically what I want to achieve is this:
https://www.domain.com - > https://domain.com without any extra redirect https://domain.com - > https://domain.com https://www.domain.com - > https://domain.com
All the URL’s should redirect directly to https://domain.com
I have added the following code to .htaccess file, but it doesn’t seem to work:
#redirect all www requests to non-www. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] </IfModule> #redirect all non https requests to SSL # BEGIN rlrssslReallySimpleSSL rsssl_version[2.5.11] <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTPS} !=on [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}%/$1 [R=301,L] </IfModule
Can you please help me to achieve what I want? The above code does not seem to work. I am still seeing the extra redirect and it is increasing the TTFB.
Many thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to avoid multiple redirects?’ is closed to new replies.