我使用Grav创建了一个新网站。 旧网站的页面必须使用结束.php 的网址才能访问url /somefolder/somepage.php只是给了我“未找到文件”。 它不会引导我进入内置的Grav错误页面。如何使用GRAV中的php扩展名重定向页面
我禁用了Grav的错误插件,所以它不会妨碍。
如何重写/somefolder/somepage.php到/ somefolder/SomePage的
另外,我怎么可以重定向任何404错误到主页?
该错误是由处理:
/var/www/grav-admin/system/src/Grav/Common/Processors/PagesProcessor.php
if (!$page->routable()) {
// If no page found, fire event
$event = $this->container->fireEvent('onPageNotFound');
if (isset($event->page)) {
unset ($this->container['page']);
$this->container['page'] = $event->page;
} else {
throw new \RuntimeException('Page Not Found', 404);
}
}
我怎样才能更换行“throw new \ RuntimeException('Page Not Found',404);”有指示重定向到主页?
上述错误是只抓到对于网址不在.php结尾的.PHP
结尾的网址不被GRAV处理,所以我想它的Web服务器交给这些错误。网络服务器是nginx/1.11.9。
我试着将下面的几行添加到我的nginx.conf中,但是这并没有解决问题。
error_page 404 = @foobar;
location @foobar {
rewrite .*/permanent;
}
我没有检查这个答案的正确性,因为Grave在管理页面中有一个设置,它已经这样做了。 Grav论坛上有人向我指出了这一点。不过谢谢你的回答。 –