我有一个web应用程序需要处理URI以查找数据库中是否存在页面。我没有问题,指导URI到应用程序与的.htaccess:如何在PHP中显示Apache的默认404页面
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php?p=$1 [NC]
我的问题是,如果页面不存在,我不想用PHP编写的定制404处理器,我想这样做显示默认的Apache 404页面。有什么办法可以让PHP在确定页面不存在时将执行回执给Apache?
不是。你可以通过'header('Location:...')'做一个简单的重定向到404页面,但是这会显示为'200 OK'请求,这被认为是不好的做法。 – 2011-05-10 16:17:30
这可能会帮助你:http://stackoverflow.com/questions/4232385/php-or-htaccess-make-dynamic-url-page-to-go-404-when-item-is-missing-in-db – 2011-05-10 16:19:38
我认为这仍然没有简单的选择,http://stackoverflow.com/q/4856425/345031 – mario 2011-05-10 16:42:47