Saturday, March 9, 2019

To redirect http to https with status 301

Put this .htaccess file inside the folder for the domain:


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Then, check the status here:

https://httpstatus.io/

Be sure to enable R=301 permanent redirect, good for SEO.
R=302 is temporary redirect, bad for SEO.

More information here:

https://www.namecheap.com/support/knowledgebase/article.aspx/9770/38/how-to-use-htaccess-to-redirect-to-https-in-cpanel#rule2

No comments:

Post a Comment