Force folder to redirect to https mode

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.

  • 123 Users Found This Useful
Was this answer helpful?

Related Articles

301 Redirect from non-www to ww -- Without Looping!

So - you want to improve your search engine rankings, and SEO gurus told you that Google might be...

Add IonCube to a custom php.ini (PHP 5.3+)

IonCube is installed by default on the servers, however if you require adding custom settings...

Block a country using mod_geoip

Do you have a list of countries that you want to block access to your site? Have you tried adding...

Hotlink protecting image.php and GD images

So you've enabled cpanel's hotlink protection, but those bandwidth theives are still attacking...

How do I change my PHP version?

NOTE: If you wish to change the PHP version on a Virtual Private Server (VPS) or dedicated...