Forum Moderators: coopster

Message Too Old, No Replies

Switching to https for just one page then back to http

Have a code snippet that will send to https but entire site is https after

         

scalp8

10:14 pm on Jan 5, 2009 (gmt 0)

10+ Year Member



Here's the snippet I'm currently using:

//force redirect to secure page
if($_SERVER['SERVER_PORT'] != '443') { HEADER
('Location: ['.$_SERVER['HTTP_HOST'].$_SERVER...]
['REQUEST_URI']); exit(); }

This works great to refer the requested page to https instead of http, but the entire session from then on is in https. Is there a way to add to this so that it refers back to http once the page is left? I've seen some solutions using the htaccess file, but if possible it just seems easier to me to do it on just the selected pages that I need to be secure. Thank you.

phranque

8:53 am on Jan 6, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the links on the secure page should be fully qualified including the protocol specification (http:).

[edited by: eelixduppy at 4:54 am (utc) on Jan. 7, 2009]
[edit reason] disabled smileys [/edit]

scalp8

2:38 pm on Jan 6, 2009 (gmt 0)

10+ Year Member



phranque,
Thank you for your prompt reply. As a site owner who realized that I could benefit more if I learned some development skills, I am new to this so forgive my lack of what may seem like common knowledge. Could you clarify for me which links need to be fully qualified? There's the obvious one "'Location: [.......",...] but that seems to direct to the secure page. Where would I put the one to direct back to http?

phranque

3:30 am on Jan 7, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



all of your navigation links should be absolute urls instead of relative urls.

scalp8

6:27 pm on Jan 10, 2009 (gmt 0)

10+ Year Member



My site has a lot of pages. Perhaps the htaccess would be a simpler route. Are there any benefits to using absolute urls or using the htaccess file to control this?