Ever wondered how to redirect a page from HTTP to HTTPS? ~ Ask The Admin

Wednesday, July 02, 2008

Ever wondered how to redirect a page from HTTP to HTTPS?

Hey aTa junkies! El Di Pablo back for some geeky action. This time not for Ubuntu (Though this could be used on an Ubuntu apache server), but mainly for simple html website coding fun.

I recently set up some servers at work, two of them were VMWare GSX servers running webmin for administration (I promised Karl I would post something about webmin later) and also a McAfee ePO server. Both servers use encrypted HTTPS for secure web administration.

Now I don't know how you feel about it, but I don't want to have to type in H-T-T-P-S every time I go to a secure website. I am just too lazy for that (I'm an American for crying out loud! That is one of the reasons we have fast food!). No, I want to type in an address or server name in my browser bar and hit enter, that's it!

In order to do that, you have to have a means of redirecting traffic from unsecure port 80 to secure 443 (Or whatever port your server is listening on). You can do this easily by providing a plain html page in your servers webroot directory with the following code in it:

<meta equiv="Refresh" content="5; URL=https://yoursecuresite.com">

The content number is the number of seconds before redirection, so you can increase it or decrease it to your liking. Now instead of manually typing https://yoursecuresite.com and risking possible carpal tunnel from all of that added typing, all you have to do is type in yoursecureserver.com and let the html do the work!

There are other ways of doing this to be sure (Share your way in the comments) but this is one of the easiest ways to do it and works with all web server software be it IIS, Apache etc.

By: El Di Pablo of Bauer-Power