Jump to content

Force SSL/HTTPS


tj

Recommended Posts

I get first post in this forum! :P

 

Ok well I hope some of you will find this useful!

 

Its a line of php that will redirect the users browser to the SSL'd version of your WHM system.

 

If a user types the url of your system directly as:

http://billing.webhost.com,'>http://billing.webhost.com, nothing exchanged between the system and the user is encrypted leaving the information exposed.

 

With the code below

 

{php}
/* redirect to secure site ALWAYS?? */ 
if ($_SERVER["SERVER_PORT"] != 443)
{
  header('Location: https://billing.webhost.com/index.php');
}
 {/php}

 

If a user where to type http://billing.webhost.com he/she will be redirected to https://billing.webhost.com.

 

Just paste that in at the top of your header.tpl file.

And dont forget to change the https://billing.webhost.com/index.php to your url!

 

Just my two cents :)

Link to comment
Share on other sites

The following method might work a bit better, since it will force https:// for any URL that is entered in http:// form, not just redirect to the index page. This will only work if the billing software is on it's own domain or subdomain, however.

 

Put the following in .htaccess or in your httpd.conf:

 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

 

You can see this working with some of the following links on my site, which are in http:// form below:

http://members.websolvents.com/

http://members.websolvents.com/knowledgebase.php?action=displayarticle&catid=3&id=14

http://members.websolvents.com/domainchecker.php

 

 

Enjoy!

 

Kyle

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated