【发布时间】:2016-10-07 05:04:35
【问题描述】:
我已经为我网站中的一个文件夹编写了重写规则。
它看起来像这样:
#page rewrites
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([\w-]+)/note $1/addednote_file.php [NC,L]
作为我上面的 htaccess 规则,如果我的根目录中的任何文件夹都添加了note_file.php,则可以通过“/notes”访问。
此脚本运行良好,
但是当我尝试访问该文件时,如果该文件夹在我的根目录中不存在,则会出现 500 内部服务器错误。
在示例中,此链接为“myweb/test/events”。 “/test/ 是文件夹,它存在于我的根目录中。但是“myweb/notexist/events”。“/notexists/”是一个文件夹,它不存在于我的根目录中。当我访问此链接时“ myweb/notexist/events”它显示 500 内部服务器错误,而不是显示我的错误页面。
我的错误文档是这样的:
ErrorDocument 404 /myweb/page-couldnt-fine-reporting.php
ErrorDocument 403 /myweb/page-couldnt-fine-reporting.php
ErrorDocument 304 /myweb/page-couldnt-fine-reporting.php
请告诉我如何将此错误添加到我的错误文档中 . 谢谢!
【问题讨论】:
-
请人帮帮我
标签: .htaccess mod-rewrite url-rewriting