mod_rewrite ssl redirect
- by Thomas
Hi all,
I want to use mod_rewrite to ensure that certain pages are served with SSL and all others normally, but I am having trouble getting it to work
This works (redirect to SSL when request uri is for users or cart)
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} users [OR]
RewriteCond %{REQUEST_URI} cart
RewriteRule ^(.*)$ https://secure.host.tld/$1 [R,L]
So, to accomodate for a user not to keep browsing the site with ssl, when requesting other uris, I thought the below, but doesn't work: (when port is 443 and request uri is not one of uris that need to be served by ssl, redirect back to normal host)
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !^/users [OR]
RewriteCond %{REQUEST_URI} !group
RewriteRule ^/?(users|groups)(.*)$ http://host.tld/$1 [R,L]
Any help?
Thanks