404页面,如果url包含/index.php/


404 page if url contains /index.php/

我有一个htaccess文件,它将所有流量重定向到我的index.php进行路由。

该应用程序也可以使用这样的url"example.com/index.php/blogg/"

如果url看起来像"example.com/index.php/blogg/",我会尝试404 url,但让url"example.com/logg/"通过

Haccess文件

# Send the URI to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

提前感谢!

您可以插入一个新规则来为您的新需求发送404:

RewriteCond %{THE_REQUEST} /index'.php [NC]
RewriteRule ^ - [L,R=404]
# Send the URI to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]