Jump to content
Larry Ullman's Book Forums

Redirect From Https Back To Http


Recommended Posts

Hi there. How you all doing? :)

 

I'm in the process of setting up an online store for my website, using the Effortless E-Commerce book to help me out. Its all going great, but I would like to be able to return visitors back to non secure pages when they are done using secure pages.

 

Currently I am using this code in my .htaccess file, adapted direct from Larry's book

 

# For HTTPS pages:
RewriteCond %{HTTPS} off
RewriteRule ^(register.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L]

 

Unfortunately it has the effect of turning all my links into https links, so after visting the register page the rest of the links are https....index.php etc instead of http....index.php.

 

Is there a way I can switch back to non secure pages?

 

Thanks in advance

Skippy

Link to comment
Share on other sites

I have a question related to this as well. Sessions and cookies that are set via https do they follow over to http or do you need to reset the session for http? Someone logs in via https then when you direct to http are they still logged in? I don't have a way to test this yet but heard that they don't follow but I am not sure.

 

 

Thanks.

Link to comment
Share on other sites

That code doesn't turn all your links into HTTPS links. That code ensures that register.php and the admin directory are accessed via HTTPS. What turns all the links on register.php into HTTPS links is the use of relative links. Since register.php is HTTPS, any relative link on that page is HTTPS. To get people to pages via HTTP, create absolute links to HTTP.

Link to comment
Share on other sites

 Share

×
×
  • Create New...