Force folder to redirect to https mode

Sometimes webmasters need to force particular folders to load in HTTPS mode.  This is ideal for the management of a back end of a shopping cart, or a forum or other scripts where sensitive information may reside.

Just create a .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.

 Reviewed: 10/14/16

  • Email, SSL
  • 34 Users Found This Useful
Was this answer helpful?

Related Articles

How do I redirect a page or folder?

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

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 to...

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 might be...

Hotlink protecting image.php and GD images

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

How to block an IP number

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