Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 404页,带htaccess_.htaccess_Http Status Code 404_Errordocument - Fatal编程技术网

.htaccess 404页,带htaccess

.htaccess 404页,带htaccess,.htaccess,http-status-code-404,errordocument,.htaccess,Http Status Code 404,Errordocument,如果我有一个重写规则设置来获取任何不是文件的名称并显示页面布局select.php 如果页面不返回任何内容,我将如何设置404,就像我键入任何内容(不存在的页面名称)一样,它仍然加载页面布局选择,但没有内容(因为它不存在) 这方面的任何帮助都会很好 谢谢我这样做的方式(尽管我确信有更好的方式)是包含一个php;如果您的正常页面有效: page-layout-select.php?page=news page-layout-select.php?page=home 等等,如果包含新闻、主页(或从

如果我有一个重写规则设置来获取任何不是文件的名称并显示
页面布局select.php

如果页面不返回任何内容,我将如何设置404,就像我键入任何内容(不存在的页面名称)一样,它仍然加载页面布局选择,但没有内容(因为它不存在)

这方面的任何帮助都会很好

谢谢

我这样做的方式(尽管我确信有更好的方式)是包含一个php;如果您的正常页面有效:

page-layout-select.php?page=news
page-layout-select.php?page=home
等等,如果包含新闻、主页(或从数据库动态写入),那么您的.htaccess可以

ErrorDocument 404 /page-layout-select.php?page=404error
其中404error也只是一个简单的include。在page-layout-select.php中,检查要显示的内容是否存在,如果不存在,则改为包含404error

我这样做的方式(尽管我确信有更好的方式)是包含一个php;如果您的正常页面有效:

page-layout-select.php?page=news
page-layout-select.php?page=home
等等,如果包含新闻、主页(或从数据库动态写入),那么您的.htaccess可以

ErrorDocument 404 /page-layout-select.php?page=404error

其中404error也只是一个简单的include。在page-layout-select.php中,检查要显示的内容是否存在,如果不存在,则改为包含404error

啊,是的,谢谢克里斯,我从没想过:)太好了,谢谢你。啊,是的,谢谢克里斯,我从没想过:)太好了,谢谢你。