Answer the question
In order to leave comments, you need to log in
Why doesn't redirect to 404 work in .htaccess?
It is required to rewrite to /404 for all non-existent files/folders on the server, except for static files (css, js, etc.). I've already tried dozens of options, it doesn't work anyway. I already memorized the first 10 pages of Google results on the problem. For example:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(css¦jpg¦gif¦zip¦js)
RewriteRule . /404 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} \.(xml|txt)$
RewriteRule . /404 [L]
Answer the question
In order to leave comments, you need to log in
¦
What is this symbol. You also need to indicate that with your config, this will not be a normal 404 error, but will only display a page with that name.
How to redirect Apache before it gives a 404 error?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question