如何正确重定向到错误页面? PHP

时间:2016-04-02 17:37:45

标签: php .htaccess xampp

如何重定向到我的错误页面?

我的目录结构:

enter image description here

在.htaccess文件中:

ErrorDocument 404 /Index.php?controller=Main&action=error

我不知道如何正确判断,但它将我重定向到../返回一个级别..,在xampp ../将是索引文件...并显示: enter image description here

我想将404错误重定向到索引。

我尝试在.htaccess文件中添加以下行:

 ErrorDocument 404 Index.php?controller=Main&action=error

但没有/ flash它的显示文字如下:enter image description here

1 个答案:

答案 0 :(得分:1)

输入绝对URI,例如ErrorDocument 404 /Index.php?controller=Main&action=error

请参阅https://httpd.apache.org/docs/2.4/mod/core.html#errordocument

相关问题