E
E
Eduard Lisetskiy2020-02-01 21:02:22
htaccess
Eduard Lisetskiy, 2020-02-01 21:02:22

Why is RedirectMatch 404 not working?

I can not understand why such a simple rule does not work.
RewriteEngine On
RedirectMatch 404 ^.*$

In general, .htaccess works correctly on websites, but this rule doesn't. I tried to create a rule for this directory in the main directory of the site, it also does not work.

RewriteEngine On
RedirectMatch 404 ^/mydir/.*$

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-02-03
@shambler81

it's better not to use a redirect match at all, since it is not needed at all
for any work with redirects, it's easier to use the RewriteCond+ rule.
we also don’t forget that
there is such a thing
ErrorDocument 404 /404.html
. Also, that 404 should actually be handled by php, since a physically missing page does not mean that the engine is not ready to give it away.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question