Ad

Simple Http (including Www) To Https Htaccess

- 1 answer

I want to verifiy that if my redirection code is implemeted good to dont have problems in seo. Currently using this code:

I want to do this:

 - http://mydomain.tld to https://www.mydomain.tld
 - http://www.mydomain.tld to https://www.mydomain.tld

My currently code is:

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Currently is redirecting but I dont know if 301 is implemented good?

Ad

Answer

If you're concerned if a redirect is having a negative impact on organic rank, such as multiple redirects (rather than one clean redirect), you can use this tool to check each redirect 'hop':

RedirectDetective.com

Ad
source: stackoverflow.com
Ad