mirror of
https://github.com/getgrav/grav.git
synced 2026-07-04 12:49:06 +02:00
Also support system.pages.append_url_extension [#3130]
This commit is contained in:
@@ -106,8 +106,12 @@ class PagesServiceProvider implements ServiceProviderInterface
|
||||
// Default route test and redirect
|
||||
$redirectCode = (int)$config->get('system.pages.redirect_default_route', 0);
|
||||
if ($redirectCode && \in_array($uri->method(), ['GET', 'HEAD'], true)) {
|
||||
if ($route !== $path || \in_array($uri->extension(), ['htm', 'html'], true)) {
|
||||
$grav->redirect($url, $redirectCode > 300 ? $redirectCode : null);
|
||||
$urlExtension = $page->urlExtension();
|
||||
$uriExtension = $uri->extension();
|
||||
$uriExtension = null !== $uriExtension ? '.' . $uriExtension : '';
|
||||
|
||||
if ($route !== $path || ($urlExtension !== $uriExtension && \in_array($uriExtension, ['htm', 'html', null], true))) {
|
||||
$grav->redirect($url . $urlExtension, $redirectCode > 300 ? $redirectCode : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ class Uri
|
||||
* Return the Extension of the URI
|
||||
*
|
||||
* @param string|null $default
|
||||
* @return string The extension of the URI
|
||||
* @return string|null The extension of the URI
|
||||
*/
|
||||
public function extension($default = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user