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.

  • 28 Users Found This Useful
Was this answer helpful?

Related Articles

301 Redirect for All Domains

So you've purchased a ton of domains to park on your main account, but you don't want Google...

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

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

Block a country using mod_geoip

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

How do I redirect a page or folder?

have removed a file from being on the website and would like to forward people who were...

How to block an IP Address

A user is accessing our website and we'd like to block this user as they continue to submit...