Allow URLs to be rewritten to server root using external .htaccess
For example, with the following directory structure, Bludit is installed in its own subdirectory: web_root ├── .htaccess └── bludit ├── bl_content ├── bl_kernel │ ... ├── .htaccess ├── index.php └── install.php However, it may be desired that Bludit's URLs are based from the web root, not /bludit: Good: http://example.com/about Bad: http://example.com/bludit/about The config file web_root/.htaccess includes the following rule to rewrite requests to web_root/bludit: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) bludit/$1 [NC,L,QSA] When a page is accessed, Bludit finds that the URL /about doesn't match the script path bludit/index.php, and assumes that the site's root should therefore be "/".
This commit is contained in:
parent
d17550c736
commit
d8a73e7951
@ -209,12 +209,16 @@ elseif( empty($base) ) {
|
|||||||
$base = dirname($base);
|
$base = dirname($base);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($base!=DS) {
|
// Assume URLs are rewritten to server root if current URL doesn't start with $base
|
||||||
|
if (strpos($_SERVER['REQUEST_URI'], $base) !== 0) {
|
||||||
|
$base = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($base!=DS and strlen($base > 0)) {
|
||||||
$base = trim($base, '/');
|
$base = trim($base, '/');
|
||||||
$base = '/'.$base.'/';
|
$base = '/'.$base.'/';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Workaround for Windows Web Servers
|
|
||||||
$base = '/';
|
$base = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +84,16 @@ elseif( empty($base) ) {
|
|||||||
$base = dirname($base);
|
$base = dirname($base);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($base!=DS) {
|
// Assume URLs are rewritten to server root if current URL doesn't start with $base
|
||||||
|
if (strpos($_SERVER['REQUEST_URI'], $base) !== 0) {
|
||||||
|
$base = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($base!=DS and strlen($base > 0)) {
|
||||||
$base = trim($base, '/');
|
$base = trim($base, '/');
|
||||||
$base = '/'.$base.'/';
|
$base = '/'.$base.'/';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Workaround for Windows Web Servers
|
|
||||||
$base = '/';
|
$base = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user