Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

AEM Dispatcher vhost settings with rewrite rule is not working

Avatar

Level 2

I am unable to get the rewrite working on Dispatcher module of AEM. Following is what's happening with my configuration:

Dispatcher configuration (I am using this approach https://docs.adobe.com/docs/en/dispatcher/disp-domains.html#The Web Server Rewrites Incoming URLs):

Snippet of my httpd.conf

LoadModule dispatcher_module modules/mod_dispatcher.so <IfModule disp_apache2.c> DispatcherConfig conf/dispatcher.any DispatcherLog    logs/dispatcher.log DispatcherLogLevel 3 DispatcherNoServerHeader 0 DispatcherDeclineRoot 0 DispatcherUseProcessedURL 0 DispatcherPassError 0 </IfModule> <VirtualHost *:80> ServerName mobile.example.com.au DocumentRoot "/var/www/html/content/mobile" RewriteEngine  on RewriteRule    ^/(.*)\.html$  /content/mobile/$1.html [PT] <Directory "/var/www/html/content/mobile"> <IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On </IfModule> Options FollowSymLinks AllowOverride None # AddType text/html .html # AddOutputFilter INCLUDES .html # Options +Includes </Directory> </VirtualHost> ......

Now, if I try to access the mobile.example.com.au/home.html, it shows up this 404 and says no content:

 

Now, if I try to access the mobile.example.com.au/home.html, it shows up this 404 and says no content:

Not Found

The requested URL /content/mobile/home.html was not found on this server.

Though I am able to hit the page directly by using the full path:http://mobile.example.com.au/content/mobile/home.html and the page is rendered.

What am I missing here? Is it something to do with the Document root?

Also, how do we set the default landing page for mobile.example.com.au to show up home.html.

1 Accepted Solution

Avatar

Correct answer by
Employee

>Also, how do we set the default landing page for mobile.example.com.au to show up home.html.

You need a rule that maps mobile.example.com.au to  home.html

The requested URL /content/mobile/home.html was not found on this server

Have you checked your dispatcher log to see what the output is when the request comes in this URL?

Is all your config in httpd.conf or are you using a dispatcher.any as well?

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

>Also, how do we set the default landing page for mobile.example.com.au to show up home.html.

You need a rule that maps mobile.example.com.au to  home.html

The requested URL /content/mobile/home.html was not found on this server

Have you checked your dispatcher log to see what the output is when the request comes in this URL?

Is all your config in httpd.conf or are you using a dispatcher.any as well?

Avatar

Level 2

Thanks Opkar Gill, I have got everything working using Sling Mapping. Apache rewrites arent still working. 

I am using structured dispatcher.any for different farms and vhosts. 

its more like a problem with Apache configuration I guess. 

Anyway, for now I have it working using Sling which I think is not bad either.