Pages

Monday, July 16, 2012

Redirect Non-Secure request to Secure


You can use following code in .htaccess file under the document root of the URL to redirect http requests to https.

RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^.*$ “https://domain.com” [R=301,L]


RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^.*$ “https://domain.com” [R=301,L]

No comments:

Post a Comment