943,902 Members | Top Members by Rank

Ad:
  • eCommerce Discussion Thread
  • Marked Solved
  • Views: 1692
  • eCommerce RSS
Aug 5th, 2008
0

HTTPS problem

Expand Post »
Hi Everyone.

This may seem a pretty basic question but here goes....
on my domain https:// if you take away the 's' from the http you can still view the secured section, what i need is it to either provide an error or better still make the page redirect to where they are and replace the 's' in the url....if you get what i mean.

Sorry to appear vague ....... any ideas?
The site is in php too if that helps......or not!


Cheers
EMHMK1
Similar Threads
Reputation Points: 11
Solved Threads: 7
Junior Poster
emhmk1 is offline Offline
107 posts
since Feb 2008
Aug 5th, 2008
0

Re: HTTPS problem

The best thing you can do is force the page to be viewed only by https which is not hard to do and can be done several ways. (BTW, unless you link to the non https version of that page users should never be able to get there in the first place unless they're doing something naughty).

To do it with Apache put this code in a file called .htaccess in the same directory as the file you want to force the http:

Redirect permanent http://www.domain.com/page.php https://www.domain.com/page.php

If you're using PHP you can put this at the top of the page to accomplish the same thing:

php Syntax (Toggle Plain Text)
  1. <?php
  2. $https_url = 'https://www.domain.com';
  3. if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'off' )
  4. {
  5. header('location: ' . $https_url);
  6. exit;
  7. }
  8. else if ( !isset( $_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] == 443 )
  9. {
  10. header('location: ' . $https_url);
  11. exit;
  12. }
  13. ?>
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Aug 6th, 2008
0

Re: HTTPS problem

Cheers Sty,

The php version is a peach.

Thanks very much.

EMHMK1
Reputation Points: 11
Solved Threads: 7
Junior Poster
emhmk1 is offline Offline
107 posts
since Feb 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in eCommerce Forum Timeline: BusyBox Creators Sue Extreme Networks
Next Thread in eCommerce Forum Timeline: Wordpress for ecommerce?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC