Friday, August 6, 2010

Push Administration/Registration/Login Prestashop using SSL

Coz, someone ask how to make administration,login page using SSL in id-freebsd milis, I am trying for Prestashop and make some modification in preference and code. The modification code is in the login.php in admin folder(I got it from http://www.netshinesoftware.com/security/using-an-ssl-certificate-with-your-joomla-website.html)

add the following code in login.php

//Redirect to https if accessed over http (except when running locally)
if ($_SERVER['SERVER_NAME'] != "localhost")
{
$port = $_SERVER["SERVER_PORT"];
$ssl_port = "443"; //Change 443 to whatever port you use for https (443 is the default and will work in most cases)
if ($port != $ssl_port)
{
$host = $_SERVER["HTTP_HOST"];
$uri = $_SERVER["REQUEST_URI"];
header("Location: https://$host$uri");
}
}

The code above is if the origin port is not equal to the ssl port so redirect to the location of https://$host$uri

That script will push using port 443 if the origin site are in port 80.

And below is for registration and login in prestashop. Simple just go to preference in admin page.
Just enable to Yes.

Enable SSL Yes No

If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing

Or you can using rewrite module in apache. Please read the http://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples.html for good explanation.

No comments:

Post a Comment