Force SSL on a certain directory
I have a website with a properly installed SSL cert. Now, I would like to setup apache so that all pages in the /members/ folder and sub-folders are forced to https, even if the link to the page or the user types in http.
Is there anyway to do this on the Apache end so that the user cannot disable SSL?
Thank you!
3 Replies
Something like this in your main server config.
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/members(.*)$ https://%{HTTP_HOST}/members/$1 [L,R]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/members(.*)$ https://%{HTTP_HOST}/members$1 [L,R]
My slightly modified code, removed a slash.