简体   繁体   中英

404 page if url contains /index.php/

I have a htaccess file that redirects all traffic to my index.php for routing.

The app works with a url like this as well "example.com/index.php/blog/"

I and trying to 404 the url if it looks like "example.com/index.php/blog/" but let the url "example.com/blog/" go through

Htaccess file

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

Thanks ahead of time!

You can insert a new rule to send 404 for your new requirement:

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^ - [L,R=404]

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM