I
I
ildar r. khasanshin2017-04-01 15:46:33
htaccess
ildar r. khasanshin, 2017-04-01 15:46:33

How to compose rule to exclude .html in RewriteRule?

RewriteRule ^(.*)\.html$ 404.php [R=404]
how to do negation, i.e. where to add!
so that the rule works for /123.htm, /123, ..
well, of course, so that for / does not work
, you can test here htaccess.mwl.be

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-04-03
@shambler81

The first time I see a question with an answer, well, just put it!
cond is if and if and if then
RewriteCond
RewriteCond
RewriteCond
then

RewriteCond %{REQUEST_URI} !index.\html$
RewriteRule ^(.*)\.html$ 404.php [R=404]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question