Answer the question
In order to leave comments, you need to log in
How to set a condition in htaccess so that if there is something in the url after the second slash, it redirects to 404?
How to set a condition in htaccess so that if there is something in the url after the second slash, it redirects to 404?
example if the url is https://toster.ru/question/here_there_is_something_
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_URI} ^question/.+ [NC]
RewriteRule . - [R=404,L,NC]
RewriteCond %{REQUEST_URI} ^.+?/.+ [NC]
RewriteRule . - [R=404,L,NC]
RewriteCond %{REQUEST_URI} ^([^\/].+)\/) [NC]
RewriteRule . - [R=404,L,NC]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question