Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
fixup! Don't redirect to REQUEST_URI when browsing to index.php Inste…
Browse files Browse the repository at this point in the history
…ad, we can make sure everything works correctly on index.php
  • Loading branch information
Rudloff committed Feb 20, 2022
1 parent 3ab22c6 commit 2afbfb4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion classes/Factory/ViewFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ private static function cleanBasePath(Uri $uri): Uri
{
$basePath = $uri->getBasePath();
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,
* 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.
*/
$uri = $uri->withBasePath(dirname($basePath));
$uri = $uri->withBasePath($basePath);
}

return $uri;
Expand Down

0 comments on commit 2afbfb4

Please # to comment.