Http to Https Redirect Htaccess - Htaccess

How to redirect http traffic to https using an .htaccess file?

Snippet Code


  
Rate this page :
  [ 0 votes]

The following code when added to an .htaccess file will automatically redirect any http traffic to https.

RewriteCond %{HTTP_HOST} ^hscripts.com RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] (OR) RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Tags


Ask Questions

Ask Question