我在我的htaccess中有一个index.php的重定向规则,现在如果url包含index.php / anything,那么它应该显示带有404代码的错误页面

时间:2017-02-06 13:38:08

标签: php apache .htaccess redirect mod-rewrite

我的htaccess文件具有以下配置,我已将www.example.com/index.php重定向到www.example.com

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php/ /error-404 [P]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]

但是现在我有一些由Google网站管理员工具提供的网址,它们显示的是软404页面,所有网址都包含index.php

即。 www.example.com/index.php/anything

我可以使用htaccess显示404页面,但它没有返回404响应代码。我想显示404页面以及响应代码404作为回报。

0 个答案:

没有答案
相关问题