reformed
reformed

Reputation: 4808

Is there a way to view hits for specific .htaccess rewrite rules?

Does Apache log requests that get met with a specific .htaccess rewrite rule? Is there a way to know which rewrite rules are actively being triggered?

For example, if I have 5 rewrite rules, is there a way I can see that rule #1 has been triggered 100 times, #2 200 times, #3 52 times, etc.?

Upvotes: 2

Views: 210

Answers (1)

Vrac
Vrac

Reputation: 1084

(Making this an answer instead of comment)

Yes, you could enable logging for mod_rewrite and then parse the Apache error log for the expression. It would log a ton of info, probably not something you would want to do regularly on a production server. See Apache documentation at: httpd.apache.org/docs/current/mod/mod_rewrite.html#logging. It will log entries like: RewriteCond: input='/blahblah' pattern='!^/site/' => matched, where input is the request and pattern is your rule. I'm not aware of any other way, unless you implement some logging in the pages that are executed as the result of the rule.

Upvotes: 2

Related Questions