Force folder to redirect to https mode Print

  • 127

Sometimes webmasters need to force particular folders to load in HTTPS mode. This is ideal for management of a back end of a shopping cart, or a forum or other scripts where sensitive information may reside.
Just create an .htaccess in the folder "yourfolder" for example, and enter the following in the .htaccess file:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} yourfolder
RewriteRule ^(.*)$ https://www.yourdomain.com/yourfolder/$1 [R,L]
This will redirect users to the HTTPS version of that folder rather than allowing them to load up in HTTP mode.


Was this answer helpful?

« Back