.HTAccess Force HTTPS Redirection

SSL – HTTPS is now a signal in Googles algorithm and is a must for eCommerce websites. Once you have a SSL certificate you need to make sure all NON HTTPS URLS redirect to HTTPS. The bleow htaccess snippets achieve this.

For Apache servers:

RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

For Nginx then you need to use the below code for TLS termination:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]

NEED HELP?

If you are struggling to implement the SVG snippet then we can help from £9.99 – use our contact form below and we will get straight back to you!

HELP ME IMPLEMENT THIS SNIPPET

Leave a comment

Shares