/>/>
  

Friday, July 31, 2009

Force SSL/https using .htaccess and mod_rewrite (SSL Web Hosting)

Sometimes you may charge to accomplish abiding that the user is browsing your armpit over securte connection. An accessible to way to consistently alter the user to defended affiliation (https://) can be able with a .htaccess book absolute the afterward lines:

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]


Please, note that the .htaccess should be amid in the web armpit capital folder.

In case you ambition to force HTTPS for a accurate binder you can use:

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteCond %{REQUEST_URI} somefolder

RewriteRule ^(.*)$ https://www.domain.com/somefolder/$1 [R,L]

The .htaccess book should be placed in the binder area you charge to force HTTPS.

No comments:

Post a Comment