URL rewriting using apache mod_rewrite along with dispatcher causing request redirection.
Hi,
I have setup Apache 2.2 , AEM 5.6.1 and dispatcher on my windows machine. I have also setup Apache mod_rewrite rules to perform URL rewriting from external facing SEO URLs to internal AEM URLs. The issue I am facing is that after rewriting the URL the request is getting redirected, as a result of which the browser URL is changing to the internal AEM URL . I don't want to change the browser URL and would like it to still show the SEO URL.
I added a flag [PT] for the rewrite rule to ensure that that the processed URL is handed over to dispatcher. The rewrite worked and the page was picked from AEM by the dispatcher but the URL on the browser changed to the rewritten URL. I am not using the [R] flag in the rewrite rules so not sure why the URL is changing. One additional observation ,when I remove the dispatcher configuration from my httpd.conf, the URL on the browser does not change, so I am guessing it is the combination of Apache, mod_rewrite and dispatcher that is playing a trick or I may be missing something here. Has anyone faced a similar issue ? It would be great to hear from you.
Example: http://localhost:8080/test/abc/def/ghj/test-results.html - SEO URL. The SEO URL on the browser is changing to http://localhost:8080/content/myproj/en_us/home/mytest/search-index/test-results.html and the page is getting loaded by dispatcher which fetches it from CQ.
httpd.conf
<IfModule disp_apache2.c>
DispatcherConfig conf/dispatcher_new.any
DispatcherLog logs/dispatcher.log
DispatcherLogLevel 3
DispatcherNoServerHeader 0
DispatcherDeclineRoot 0
DispatcherUseProcessedURL 1
DispatcherPassError 0
</IfModule>
<VirtualHost *:8080>
ServerName localhost
RewriteRule ^/test/(.*)/(.*)/(.*)/(.*)\.html$ /content/myproj/en_us/home/mytest/search-index/$4.html [PT]
</VirtualHost>
Thanks in advance for your help.
Regards
Asit
