Forum Moderators: phranque
What I want to is be able to enter a particular directory in ssl and whenever i leave that directory exit ssl. I am using phpnuke, this is a particular module and the directory location is /html/modules/giftlist
I have tried a few things in httpd.conf and didn't really get anything working
eg.
RewriteCond %{SERVER_PORT}!^443$
RewriteRule ^(.*)$ [192.168.0.1...] [R,L]
would really appreciate some help please?
Welcome to WebmasterWorld!
> I want to is be able to enter a particular directory in ssl and whenever i leave that directory exit ssl
This would require state transition information that is not available to the server. You can, however, implement it with some code changes as: "I want to use SSL while in a particular subdirectory and whenever not in that subdirectory exit SSL."
# "Enter" SSL
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^html/modules/giftlist(.*)$ https://example.com/html/modules/giftlist$1 [R=301,L]
# "Leave" SSL
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/html/modules/giftlist
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Jim
here is what i put into httpd.conf as u suggested.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteLog logs/https_rewrite_log
RewriteLogLevel 1
# "Enter" SSL
RewriteCond %{SERVER_PORT}!^443$
RewriteRule ^/html/modules/giftlist(.*)$ https://192.168.0.1/html/modules/giftlist$1 [R=301,L]
# "Leave" SSL
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI}!^/html/modules/giftlist
RewriteRule (.*) http://192.168.0.1/$1 [R=301,L]
</IfModule>
This code works fine and enables SSL when entering the directory /html/modules/giftlist but i'm afraid when i leave the directory it doesn't exit SSL and go back to ordinary http. Any ideas, I tried playing about with
RewriteCond %{REQUEST_URI}!^/html/modules/giftlist
RewriteRule (.*) http://192.168.0.1/$1 [R=301,L]
by changing various bits at a time, restarting server and still no joy
RewriteCond %(SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/html/modules/giftlist
RewriteRule [b]^/[/b](.*) http://192.168.0.1/$1 [R=301,L]
RewriteCond %(SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/html/modules/giftlist
RewriteRule ^/(.*) http://192.168.0.1[b]:80[/b]/$1 [R=301,L]
Jim
I am going to just hardcode the exiting of ssl into my website code. Originally i wanted the Giftlist directory to be SSL and people can buy items of a gift list, credit card etc. So once theyre done i will just link back to index with [......]