ENHANCEMENT Director::forceSSL() redirects are now 301 instead of 302 redirects, which is better for SEO

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61154 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-08-20 04:54:24 +00:00
parent 41c9d5692e
commit 1f846970c3

View File

@ -495,10 +495,10 @@ class Director {
* </code>
*/
static function forceSSL() {
if(!isset($_SERVER['HTTPS']) && !Director::isDev()){
$destURL = str_replace('http:','https:',Director::absoluteURL($_SERVER['REQUEST_URI']));
if(!isset($_SERVER['HTTPS']) && !Director::isDev()) {
$destURL = str_replace('http:', 'https:', Director::absoluteURL($_SERVER['REQUEST_URI']));
header("Location: $destURL");
header("Location: $destURL", true, 301);
die("<h1>Your browser is not accepting header redirects</h1><p>Please <a href=\"$destURL\">click here</a>");
}
}