Expand my Community achievements bar.

Redirection Not working specific pages in Dispatcher server

Avatar

Level 1

I have an AEM environment where I uploaded a package containing certain pages into the Package Manager. For example, I am currently on the /content/demo page, and the uploaded package contains pages under /content/sample/*. After uploading the package in the Publish environment, the redirection works successfully there, but it does not work on the Dispatcher server. Do I need to make any changes to the rewrite rule for the pages to reflect properly?

5 Replies

Avatar

Level 1

@Murali__D : Can you explain a bit more detail about it ? The redirect you are referring to, is it a vanity redirect , sling redirect ? There could be a possibility where you have a rewrite rule in the dispatcher for the given content directory and it might be interfering with the redirects.

Avatar

Level 1

Hello, @Ashwani-Agrawal , Thank you for your response. Above question is bit confusing So below I mentioned clearly

In the dispatcher environment, when I open any page, it redirects to only one static page. For example:

http://test.domain/content/sample/page.html - works correctly.
However, the URL,  http://test.domain/page.html - does not work.

It seems like the /content/sample/ part of the URL is not being hidden correctly in the background. If I use the full path starting with /content, it works fine, but the shortened path does not.

How can I resolve this issue?

Avatar

Level 1

Hi @Murali__D : This is happening because you don't have URL mapping set up in your publish AEM server. Follow the steps as below :

  1. navigate to http://<host>:<port>/system/console/configMgr
  2. search for Apache Sling Resource Resolver Factory
  3. open the configuration dialog and look for URL Mappings Field
  4. In the URL mappings field, click on + icon and enter the value as /content/sample/:/
    This configuration will prepend all the request with /content/sample/. For eg. if you access http://test.domain/page.html, the request goes to publisher and above configuration will internally prepend "/content/sample/" to the request URL. So the actual URL becomes http://test.domain/content/sample/page.html for AEM and the content will be served, but in the browser you will only see http://test.domain/page.html.
  5. In your dispatcher vhost file, make sure to add this rule
    RewriteRule ^/page$ /content/sample/page.html [PT,L]

Try this configuration and update us if this works.

Avatar

Level 1

@Ashwani-Agrawal , Thanks you. 

However, the URL,  http://test.domain/page.html working fine in publish environments but it does not work only dispatcher server. 

Avatar

Level 1

Hi @Murali__D : do you have rewrite rule set up in your vhost file as mentioned in my previous comment (step 5)