Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Vanity URL not working in Cloud publish instance and dispatcher

Avatar

Employee

I have followed all the steps from adobe document
https://experienceleague.adobe.com/docs/experience-manager-learn/ams/dispatcher/disp-vanity-url.html...

 

vanity url config ex:

page path: /content/brandx/us/en/headerpages/test/test-page.html

in this page property I have configured vanity url as /test-page so it should serve as domainname/test-page.html but it's throwing 404 in both publish & dispatcher which is working perfectly in author instance.

 

I have checked vanity url list under this path its showing in both publish&dispatcher link

/libs/granite/dispatcher/content/vanityUrls.html

 

vanity url is working: whenever I am prefixing "/content" [/content/test-page]

vanity url not working: whenever I am configuring without "/content" [test-page]

 

Kindly, help me with this to fix asap. Thanks in advance!

 

CC    @Mohit_KBansal 

        @kautuk_sahni 

8 Replies

Avatar

Community Advisor

@jeromeleslyv 

Please enable the following log levels. That would help you in debugging

 
Define DISP_LOG_LEVEL info
Define REWRITE_LOG_LEVEL trace2

 

Please verify if any rewrite rule is interfering and resolving to this behaviour 


Aanchal Sikka

Avatar

Employee
RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} !^/bin/
RewriteCond %{REQUEST_URI} !^/system/sling/logout
RewriteCond %{REQUEST_URI} !^/BingSiteAuth.xml
RewriteCond %{REQUEST_URI} !^.*sitemap\.xml
RewriteCond %{REQUEST_URI} !^/google
RewriteRule ^/(.*)$ /content/brands/brandone/us/en/$1 [PT,L]

this is our project rewrite rule

Avatar

Community Advisor

Hi,

 

If you can hit the vanityUrl prefixing "content" most likely the issue is with your rewrite rules, please check this article which is the cloud version of the one you shared and explains how the resolution works at the dispatcher level: https://experienceleague.adobe.com/docs/experience-cloud-kcs/kbarticles/KA-17463.html?lang=en#resolu...



Esteban Bustamante

Avatar

Employee

Yes, I know the issue. Since I have written dispatcher rewrite rule like this

RewriteRule ^/(.*)$ /content/brands/brandone/us/en/$1 [PT,L]

 so it will do internal search like below only tha's why throwing 404 error

note:test-page is a vanity url
/content/brands/brandone/us/en/test-page

 

I would like to know what will be solution for this? I should add /content/ or any other solution?

Avatar

Administrator

Your current rewrite rule (RewriteRule ^/(.*)$ /content/brands/brandone/us/en/$1 [PT,L]) rewrites all requests starting with / to a specific pattern. This is conflicting with your vanity URL for /test-page, as the dispatcher tries to rewrite it to /content/brands/brandone/us/en/test-page which doesn't exist.

Solutions:

  1. Modify the Rewrite Rule:
  • Option A (Targeted Rewrite): Create a specific rule for your vanity URL: RewriteRule ^/test-page$ /content/brands/brandone/us/en/test-page.html [PT,L]This only rewrites /test-page to the correct target path, leaving other requests untouched.
  • Option B (Capture Group Rewrite): Use a capturing group to rewrite any vanity URL: RewriteRule ^/(.*)$ /content/brands/brandone/us/en/$1 [PT,L]| This captures the vanity URL name (e.g., "test-page") and inserts it into the target path, dynamically handling any vanity URL.
  1. Leverage Dispatcher Vanity URL Handling:
  • Enable Dispatcher Auto-Allow Filters: Install the VanityURLS-Components package and configure the dispatcher to point to the package page. This allows the dispatcher to automatically recognize and handle vanity URLs based on the /libs/granite/dispatcher/content/vanityUrls.html list. Add your test-page URL to this list.


Kautuk Sahni

Avatar

Employee

Any solutions Folks? It's not even working in publish url

@aanchal-sikka  @EstebanBustamante @kautuk_sahni 

Avatar

Administrator

The possible reasons why your vanity URL might not be working:

  • Dispatcher configuration:The document mentions that the dispatcher configuration points to a package that the AEM instance uses to fetch a list of vanity URLs that it should allow through. Make sure that the package is installed and configured correctly on your dispatcher.
  • Content access filters: The content access filters are used to filter out requests at the path / through the Dispatcher because that's the root of the JCR tree. Make sure that the filters are not blocking the vanity URL. You can check the configuration of the filters in the Dispatcher farm file.
  • Vanity URL list:The vanity URL list is a list of URLs that the Dispatcher is configured to allow through. Make sure that the vanity URL is added to this list. You can find the list in the /libs/granite/dispatcher/content/vanityUrls.html file on the publish server.
  • Dispatcher auto-allow filters:The dispatcher auto-allow filters are used to allow vanity URLs to reach the publishers while staying secure. These filters are disabled by default. You can enable them by installing the VanityURLS-Components package and configuring the dispatcher to point to the package page.

In addition to the above, here are some other things you can check:

  • Check the dispatcher logs for any errors related to the vanity URL.
  • Restart the dispatcher.
  • Clear the dispatcher cache.


Kautuk Sahni

Avatar

Administrator

@jeromeleslyv Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni