zennedOut
- Join Date:
- Nov 2005
- Location:
- los angeles
- Posts:
- 2,974
- Plugin Contributions:
- 8
Proposal: use PHP to redirect to https
for zc 1.5.5 (and/or beyond);
with some store owners looking to get their whole site https, i think there is an element that is missing. there is a page (that i could not find) that says to make the whole site https to change the configure to something like:
define('HTTP_SERVER', 'https://example.com');
define('HTTPS_SERVER', 'https://example.com');
with regards to the enable_ssl constant,the suggestion is to keep it set to true, requiring some overhead, but then payment modules that look for that constant do not get disabled.
the missing element is when someone lands on a non-https page from outside the domain, and then store owners are forced to make changes to htaccess file to do a redirect to the https page. and ZC does not come with a htaccess file as part of the base package.
with some add-ons using ajax to add-to-cart, if the landing page is non-https, and the redirects do not exist in the htaccess file, it could be a problem.
why not do the redirect from within ZC and minimize these problems from store owners? for example, from within includes/application_top.php and after the include of includes/configure.php, we could add something like:
if ((HTTPS_SERVER == HTTP_SERVER) && (strpos(HTTP_SERVER, 'https:') !== false)) {
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off") {
$redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $redirect);
exit();
}
}
i think this would solve the landing page issue and a lot of confusion for some store owners with regards to making the whole site https, and having to do apache redirects in the htaccess file.
thoughts?