Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

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




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


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


Please use this thread to ask the related questions.

Kautuk Sahni

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies