Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

Redirect http -> https

Views: 77
Votes: 0
How would it be possible to get my users from http:// to an https:// connection?
 
There are a couple of ways, one involves PHP and the other .htaccess. There is no real difference, so please use whichever one you feel most comfortable with.
 
To do this in .htaccess you can do the following:

RewriteEngine on
#Options +FollowSymlinks
RewriteCond % ^80$
RewriteRule ^(.*) https://yourdomain.com/cart/$1 [R,L]
 
* Please ensure that you save this file in your /public_html/ folder.
 
Below is how you can do the same in PHP:
 
<?php
 
if (!$_SERVER['HTTPS'])
 
{
 
   header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . $_SERVER['QUERY_STRING']);
 
   exit;
 
}
 
?>
 
* Please note if you are using PHP to re-direct these users, please note that you will have to save the above code as: index.php and it would go in the directory where the file that you want to change from http:// to https://
 
In addition, please remember that you can always copy the above code and put it into your own index.php to create the same effect.
Others in this Category
document Agora Cart - Payment Gateways
document Merchant Accounts
document PayPal Payment Support
document Virtual Sales Assistant
document Installing SSL on a primary domain (e.g. www.domain.com)
document Installing SSL on your cPanel
document IP Address / SSL Certificate
document Subdomain SSL - Installation



RSS