Howto require SSL for a specific directory?

#1
Hi -

I'm trying to figure out how to require SSL for a particular section of my website, but am having no luck.

I'd like all requests that match www.domain.com/somewhere to be redirected to the SSL version if it isn't SSL.

I've got both the HTTP and HTTPS versions of the site working and can go directly there, but can't figure out how to force a redirect.

Anyone know?
 

ffeingol

Well-Known Member
#2
plop this in a .htaccess in the directory where you want to force https:

Code:
rewriteEngine On
rewriteCond %{SERVER_PORT} !443
rewriteRule ^(.*)$ https://www.example.com/securedir/$1 [R,L]
 
Top