tzlil
tzlil asked
Member (0 upvotes)

Redirect Chain issue

Hello, i see in Ahrefs that i have Redirect chain issue. 

there are  2  links  

the first 301 Moved Permanently 
URL : http://www.securityfix.co.il/

the second 

URL : https://securityfix.co.il/

how to get this fixed thanks? :)  

#redirectchain
Avatar for member KnowOneSpecial
KnowOneSpecial
Moderator (84 upvotes)

Your issue is this.. 

You redirect http://www.securityfix.co.il to https://www.securityfix.co.il

Then you redirect https://www.securityfix.co.il to https://securityfix.co.il

You should just redirect all http traffic to https and do not redirect www  to https://www then to https without the www.

redirect all http traffic to https://security....

redirect all https traffic with www prefix to https without www prefix...

So you should have two conditions and one rule ...

The following code solves your issue ( oh and I prefer not to use WWW in a url.. superfluous in my opinion )

Here it is for a linux server

(this test for https not on, and it also test for www in url and if either condition is true it redirects to the correct url in one redirect no two redirects like you have on your site.

RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} ^www\.

RewriteRule (.*) https://securityfix.co.il%{REQUEST_URI} [L,R=301]

Good advice?
0
0
Comments 0
login to reply
Copyright ©2024 SEOChat. All Rights Reserved. Owned and operated by Search Ventures Ltd and Chris Chedgzoy.