I have a large htaccess with hundreds of rules. Some of them are quite old and I would like to know if they are still being used. Is there any way to find out which rules are no longer used?
Asked
Active
Viewed 76 times
1 Answers
0
Hello and welcome to SO!
By definition, there is no concept of "used" or "unused" rule in htaccess.
If a request happens and match the rule then the rule will be applied. So I think the only thing you can do is to observe your Apache http
behaviour while running.
I would do it either by:
- removing all rules then adding them back step by step until "everything works"
- adding logs and check which rules where executed, as explained in question How to debug htaccess rewrite script
But either way, if there are some uncommon requests that can happen, you should be sure to add them in your tests if you don't want to break something.

JR Utily
- 1,792
- 1
- 23
- 38
-
Thank you for your answer, but I think that none of the solutions are appropriate in this case. The web is too big, the solution should be less manual. – Zuntz Sep 19 '18 at 09:38
-
I do agree, but when you open your http server, you know what kind of request you expect, for what purpose you open the server. Keep all rules for these use cases, and reroute everything else to your home – JR Utily Sep 19 '18 at 12:49