Configuring dispatcher to get the list of Vanity URLs:
In the given example below, for the demonstration purpose, we had set up an AEM instance and dispatcher in a local machine (PC). Same procedure can be applied in real-time applications as well.
Before making changes to the dispatcher configuration file, follow the below steps:
1. Download Vanity URLs Component and install it on publish instance.
2. In order to verify that the installation is done correctly, go to /libs/granite and look for dispatcher folder. If you have the dispatcher folder created, then you have successfully installed the package.[image_with_animation image_url=”10073″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”]3. Now, give ‘Read’ permissions to Everyone group to /libs/granite/dispatcher/content/vanityUrls.
Now, let’s make changes to the dispatcher configuration file to get the list of Vanity URLs.
1. Open dispatcher.any file and add /000X { /type “allow” /url “/libs/granite/dispatcher/content/vanityUrls.html” } to the /filter section (X can be replaced with any number).[image_with_animation image_url=”10074″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”]2. Now, add a caching rule to prevent caching of this URL. In order to do this, add /000X { /type “deny” /glob “/libs/granite/dispatcher/content/vanityUrls.html” } to the /rules section (X can be replaced with any number). [image_with_animation image_url=”10075″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”]3. Now, it’s time to add the vanity_urls configuration. In order to do this, add the following to /farms section.
/vanity_urls
{/url “/libs/granite/dispatcher/content/vanityUrls.html”
/file “C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/vanity_urls”
/delay 300}
url: it is the path of the Vanity URL service that runs on the publish instance.
file : It’s path of the file that stores the list of Vanity URLs.
delay: it’s the time interval in seconds to call the Vanity URL service to get the list of updated Vanity URLs. In the above example, it calls the service for every 5 minutes.[image_with_animation image_url=”10076″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”]4. Save the file and restart the server.
5. Navigate to the file path mentioned above C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/vanity_urls and you would see the vanity_urls file is created with the list of vanity URLs.[image_with_animation image_url=”10077″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”][image_with_animation image_url=”10078″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”]6. Now, you would be able to access the page using vanity URL using dispatcher which in fact would take you to the original URL.
Example: localhost:8080/analog-dark-wash-jean
Note: If you are not able to access the page using Vanity, make sure you have not added .html while creating a vanity URL. If you have added .html to the end of vanity URL, then remove it. [image_with_animation image_url=”10079″ alignment=”” animation=”Fade In” img_link_large=”yes” hover_animation=”none” border_radius=”none” box_shadow=”none” image_loading=”default” max_width=”100%” max_width_mobile=”default”]Above dispatcher configuration is a one-time set up and restart of the server is not required every time we add a new vanity URL on AEM pages. It automatically updates the vanity URLs list with the given time interval.

Comments