RewriteRule usage stats

I would like to prune my .htaccess to get rid of many rules that no longer apply. Is there any way to detect which rules have fired “recently”?

One way would be to set the log level:
[list][*] LogLevel notice rewrite:trace3 [/list]
but then .htaccess fails and the site is inaccessible (Which seems a harsh penalty; why not just ignore the directive?)

Are there any other possibilities?

Not directly. You could search for hits matching the rules in your site’s log files, though.

Apache handles any syntax error in an .htaccess file (including directives that aren’t valid in that context, like LogLevel) by throwing a 500 error for the directory. This is harsh, but it does mean that sites which use .htaccess files for access control will “fail closed” if something goes wrong with the file, rather than “failing open” and potentially letting unauthorized users in.