I
I
ipock2019-08-17 10:28:19
URL Handling
ipock, 2019-08-17 10:28:19

How to make a 404 redirect if the url contains % htacsess?

Good afternoon.
A problem of this kind, a space or % occurs periodically in the url, it is necessary to redirect to the 404 page if the % sign occurs in the url.
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dodo512, 2019-08-17
@ipock

RewriteCond %{THE_REQUEST} %
RewriteRule ^ - [R=404,L]

You can specify your own 404 error page in ErrorDocument 404
If you need to catch addresses with spaces.
RewriteRule \s - [R=404,L]

D
Dimonchik, 2019-08-17
@dimonchik2013

give your version and what doesn't work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question