ttheb
ttheb

Reputation: 27

RedirectMatch RegEx — Need to have an exception

I have this RedirectMatch directive:

RedirectMatch 404 (.old|.csv|.txt|.sql|.ini)$

I now want to exlude robots.txt, but keep sending the 404 for all other .txt. How?

I fiddled with it looking at RedirectMatch 403 -- Need to have an exception for 1 URL in .htaccess but I could not make it work.

Can you help?

Upvotes: 1

Views: 691

Answers (1)

Tomalak
Tomalak

Reputation: 338208

You can use negative look-behind

RedirectMatch 404 (.old|.csv|(?<!robots).txt|.sql|.ini)$

Upvotes: 1

Related Questions