Configuring Access to Pages Via HTTPS Only
Solution Your secure URL is attached to the same directory as your non-secure URL and therefore loads the same files.

If you want to make 100% sure that people can't access some pages via standard HTTP, you can check for the HTTPS environment variable and redirect people to the secure page if it is not on.

In PHP, this could be done in this way:

if ($_SERVER["HTTPS"] != 'on')
{
header('Location:https://secure.your_domain.com'.$_SERVER["REQUEST_URI"]);
exit;
}


If you put that code at the top of your index.php file, for example, people accessing

http://www.your_domain.com/index.php

would be redirected to

https://secure.your_domain.com/index.php


Article Details
Article ID: 96
Created On: 23 Jan 2008 01:31 AM

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options