MINOR fixed relative URL resolver in Director::test()

MINOR improved documentation in static-main.php

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81749 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-07-14 01:21:04 +00:00
parent 48f200961e
commit 61ed3df367
2 changed files with 7 additions and 1 deletions

View File

@ -198,7 +198,10 @@ class Director {
if (@parse_url($url, PHP_URL_HOST) != '') {
$bits = parse_url($url);
$_SERVER['HTTP_HOST'] = $bits['host'];
$url = Director::makeRelative($url);
// 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'] : '');
}
$urlWithQuerystring = $url;

View File

@ -8,6 +8,9 @@
*
* If you are using StaticPublisher+Subsites, set the following in _config.php:
* FilesystemPublisher::$domain_based_caching = true;
* If you are not using subsites, the host-map.php file will not exist (it is
* automatically generated by the Subsites module) and the cache will default
* to no subdirectory.
*/
if (file_exists('../subsites/host-map.php')) {