mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Ticket #2869 Fixed PHP notice in Director::forceWWW()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63390 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
1754e6cf81
commit
b675fbe1ec
@ -503,11 +503,12 @@ class Director {
|
|||||||
* Force a redirect to a domain starting with "www."
|
* Force a redirect to a domain starting with "www."
|
||||||
*/
|
*/
|
||||||
static function forceWWW() {
|
static function forceWWW() {
|
||||||
if(!Director::isDev() && !Director::isTest() && strpos( $_SERVER['SERVER_NAME'], 'www') !== 0 ){
|
if(!Director::isDev() && !Director::isTest() && strpos($_SERVER['SERVER_NAME'], 'www') !== 0) {
|
||||||
if( $_SERVER['HTTPS'] )
|
if(!empty($_SERVER['HTTPS'])) {
|
||||||
$destURL = str_replace('https://','https://www.',Director::absoluteURL($_SERVER['REQUEST_URI']));
|
$destURL = str_replace('https://', 'https://www.', Director::absoluteURL($_SERVER['REQUEST_URI']));
|
||||||
else
|
} else {
|
||||||
$destURL = str_replace('http://','http://www.',Director::absoluteURL($_SERVER['REQUEST_URI']));
|
$destURL = str_replace('http://', 'http://www.', Director::absoluteURL($_SERVER['REQUEST_URI']));
|
||||||
|
}
|
||||||
|
|
||||||
header("Location: $destURL");
|
header("Location: $destURL");
|
||||||
die("<h1>Your browser is not accepting header redirects</h1><p>Please <a href=\"$destURL\">click here</a>");
|
die("<h1>Your browser is not accepting header redirects</h1><p>Please <a href=\"$destURL\">click here</a>");
|
||||||
|
Loading…
Reference in New Issue
Block a user