Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

AEM: debugging Apache rewrite rules on dispatcher | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

AEM: debugging Apache rewrite rules on dispatcher by Jeroen DruwÃ

Abstract

On my current project, we have many Apache rewrites rules configured. I recently discovered an issue in one of our rules that caused our product pages not to render correctly. It can be quite cumbersome to check every single rule, I went looking for a better solution and found one: mod_rewrite logging using the LogLevel directive.

Within your  directive
LogLevel alert rewrite:trace3

mod_rewrite offers detailed logging of its actions at the trace1 to trace8 log levels. The log level can be set specifically for mod_rewrite using the LogLevel directive: Up to level debug, no actions are logged, while trace8 means that practically all actions are logged. Using a high trace log level for mod_rewrite will slow down your Apache HTTP Server dramatically! Use a log level higher than trace2 only for debugging!
- http://httpd.apache.org/docs/current/mod/mod_rewrite.html#logging
tail -f error_log | fgrep '[rewrite:'

Can for example result in the following:
[rewrite:trace3] mod_rewrite.c(470): applying pattern '^/nl-be/products/([0-9]+)(/.+)?' to uri '/nl-be/products/1234.html'
[rewrite:trace2] mod_rewrite.c(470): rewrite '/nl-be/products/1234.html' -> '/content/company/be/nl.pdp.1234'

Read Full Blog

AEM: debugging Apache rewrite rules on dispatcher

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
1 Reply