Forum Moderators: phranque
What i'm trying to do is:
Make sure anybody visiting
checkout.cgi, checkout2.cgi and checkout3.cgi are using SSL.
I also want to make sure anybody visiting any other page is NOT using SSL.
I've tried this but this gives 500 internal server error.
RewriteEngine On
RewriteCond %{HTTPS} != on
RewriteCond %{REQUEST_URI} ^checkout.cgi$
RewriteRule ^(.*)$ [example.co.uk...] [L,R=301]
RewriteEngine On
RewriteCond %{HTTPS} != off
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [L,R=301]
Any help would be very much appreciated.
Thanks
[edited by: jdMorgan at 3:45 pm (utc) on July 7, 2009]
[edit reason] example.co.uk [/edit]
Other changes are to use the server variable "SERVER_PORT" instead of the mod_ssl variable "HTTPS", and to prevent an "infinite" redirection loop due to not testing for "NOT checkout.cgi" in your original second rule and a RewriteCond pattern error in your first rule.
Options +FollowSymLinks -MultiViews
RewriteEngine on
#
RewriteCond %{SERVER_PORT} !=443
RewriteCond $1 =checkout.cgi
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R=301,L]
#
RewriteCond %{SERVER_PORT} =443
RewriteCond $1 !=checkout.cgi
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [R=301,L]
Jim