PDA

View Full Version : Redirect http:// requests to https:// for whole site



reedj
01-20-2005, 10:46 PM
Could someone please suggest how I could redirect any request for a page on my site from http:// to https://? For example, when someone goes to the home page, they are automatically redirected to the secured https://mydomain.com.

In my php-coded pages, I refer to other pages beginning with $_SERVER['DOCUMENT_ROOT'] rather than simply relative links. Is there a redirect solution for the server that would allow me to keep that code, so that $_SERVER['DOCUMENT_ROOT'] is now https://www.root.site instead of http://...? (I could certainly search and replace $_SERVER['DOCUMENT_ROOT'] with "https://mydomain.com" if necessary).

I just got an SSL certificate, and would like to maximize its benefit by securing my whole site, since the login appears on the homepage.

Thanks,
Reed

wildjokerdesign
01-21-2005, 06:46 AM
There may very well be something you can set in you httpd.conf file that would change the server root but if you run all your pages through SSL your site is going to run slower. Have you thought of simply changeing the link in the login form to point to a secure connection. I think this would send the login information securely. I may be wrong about that but I know some sites have login boxes set up that way.

wildjokerdesign
01-21-2005, 09:15 AM
I went ahead and asked WH Tech about this and they replied that if you set the action url of the form to a secure url that it would work as long as the secure connection is on the same server.