Correct Method To Change HTTP To HTTPS By 301 Redirect? Will It Hurt My SEO?

- 1 answer

I have used .htaccess file to change my site HTTP to HTTPS and it seems the code works well, but I don't know if it is in the correct way and will this hurt my SEO?

The code:

Options -Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

Thanks a lot.



Your method is fine. Here are more valid configurations: http to https through .htaccess

I believe this is the most common variation:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

Regarding your SEO/ranking concerns: Switching to HTTPS won't hurt your ranking - it will help you instead.

HTTPS is a confirmed Google ranking factor since 2014. It's only a small boost, nonetheless, that's a good reason for switching to HTTPS anyways. This is even more crucial for new sites.

Moreover, in January 2017 Google (Chrome 56) started to mark HTTP pages that collect passwords or credit cards as non-secure, and beginning in July 2018 with the release of Chrome 68, all HTTPS sites will be labeled as "Not Secure".

Nobody wants to have a big red warning showing up in the address bar next to your site's URL.

Finally, HTTPS is safer for your users, at that's a good thing by itself.

PS: Ensure that your host and CDN provider supports HTTP/2. This is not required, but good for your site's performance. Also, don't forget about local citations.