Created
October 11, 2009 23:55
-
-
Save sminnee/207978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: sapphire/core/control/Director.php | |
=================================================================== | |
--- sapphire/core/control/Director.php (revision 88560) | |
+++ sapphire/core/control/Director.php (working copy) | |
@@ -199,10 +199,7 @@ | |
if (@parse_url($url, PHP_URL_HOST) != '') { | |
$bits = parse_url($url); | |
$_SERVER['HTTP_HOST'] = $bits['host']; | |
- // Implementing a custom absolute->relative code snippet as | |
- // Director::makeRelative() chokes on a url like http://localhost | |
- // it will just return the original string, not /, or ''. | |
- $url = (isset($bits['path']) ? $bits['path'] : '/') . (isset($bits['query']) ? '?'.$bits['query'] : '') . (isset($bits['fragment']) ? '#'.$bits['fragment'] : ''); | |
+ $url = Director::makeRelative($url); | |
} | |
$urlWithQuerystring = $url; | |
@@ -479,6 +476,8 @@ | |
if(preg_match('/^https?[^:]*:\/\//',$url)) { | |
$base1 = self::absoluteBaseURL(); | |
if(substr($url,0,strlen($base1)) == $base1) return substr($url,strlen($base1)); | |
+ // Convert http://www.mydomain.com/mysitedir to '' | |
+ else if(substr($base1,-1)=="/") && $url == substr($base1,0,-1)) return ""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment