fixup! Don't redirect to REQUEST_URI when browsing to index.php Instead, we can make sure everything works correctly on index.php
This commit is contained in:
parent
3ab22c654a
commit
2afbfb4bf2
1 changed files with 10 additions and 1 deletions
|
@ -45,12 +45,21 @@ class ViewFactory
|
||||||
{
|
{
|
||||||
$basePath = $uri->getBasePath();
|
$basePath = $uri->getBasePath();
|
||||||
if (str_ends_with($basePath, 'index.php')) {
|
if (str_ends_with($basePath, 'index.php')) {
|
||||||
|
$basePath = dirname($basePath);
|
||||||
|
if ($basePath == '/') {
|
||||||
|
/*
|
||||||
|
* Calling withBasePath('/') does nothing,
|
||||||
|
* we have to use an empty string instead.
|
||||||
|
*/
|
||||||
|
$basePath = '';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When the base path ends with index.php,
|
* When the base path ends with index.php,
|
||||||
* routing works correctly, but it breaks the URL of static assets using {base_url}.
|
* routing works correctly, but it breaks the URL of static assets using {base_url}.
|
||||||
* So we alter the base path but only in the URI used by SmartyPlugins.
|
* So we alter the base path but only in the URI used by SmartyPlugins.
|
||||||
*/
|
*/
|
||||||
$uri = $uri->withBasePath(dirname($basePath));
|
$uri = $uri->withBasePath($basePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
|
|
Loading…
Reference in a new issue