How to return 404 error
for all URL with extra characters after second /
by htaccess.
e.g1:
http://www.example.com/blah-blah/
NOT Redirect (no extra characters after 2th /
)
e.g2:
http://www.example.com/blah-blah/blah-blah
Redirect to 404
e.g3:
http://www.example.com/blah-blah/blah-blah/
Redirect to 404
e.g4:
http://www.example.com/blah-blah/blah-blah/blah-blah
Redirect to 404
e.g5:
http://www.example.com/blah-blah/blah-blah/blah-blah/
Redirect to 404
I tried this but not works with e.g3 & e.g5 (URLs ending with slash):
ErrorDocument 404 /404
RewriteBase /
RewriteRule ^[^/]+/.+ - [R=404,L]