AEM Vanity URL
Vanity URL’s are unique, short, descriptive and easy to remember version of actual page URL.
Actual URL — http://localhost/language/aem/practice-aem-vanity.html
Vanity URL — http://localhost/aem-vanity.html
Rules to define vanity URL’s:
- URL must not start with /
- Vanity URL must be unique.
- We can have multiple vanity URL’s for a single page. Having multiple vanity URL’s will reduce the SEO ranking.
- Vanity URL’s are case sensitive.
- We can redirect to original page using Redirect Vanity URL.
Follow below steps to setup vanity URL’s:
1. Navigate to this URL and download vanity URL’s components package.
2. Accept EULA terms and conditions and press download button highlighted red in color.
3. Upload vanityurls-components package and install on publish instance:
4. In publish instance, everyone group must have Read permission to below hierarchy:
/libs/granite/dispatcher/content/vanityUrls
5. Open dispatcher.any and add below line to allow vanity URL rule under /filter section
/0XYZ { /type “allow” /url “/libs/granite/dispatcher/content/vanityUrls.html” }
6. In same dispatcher.any file add below line under /rules sub-section of /cache section
/00XYZ { /type “deny” /glob “/libs/granite/dispatcher/content/vanityUrls.html” }
7. Add below line in dispatcher.any file will auto-allow the item or by pass the normal dispatcher, once vanity package is installed on publishers.
/vanity_urls {
/url "/libs/granite/dispatcher/content/vanityUrls.html"
/file "/tmp/vanity_urls"
/delay 300
}
8. Restart the Apache webserver to see latest changes.
9. Open page properties, scroll down below to Vanity URL section and author mens.html as vanity URL. Provide vanity URL and click on Save & Close button.
Publish the page once authoring is done.
10. Open below authored dispatcher vanity URL
http://localhost/mens.html
11. Author Redirect Vanity URL as true and publish page will for 301 internal redirect to actual page path.
Opening vanity URL http://localhost/mens.html in chrome browser will redirect to actual URL http://localhost/content/we-retail/us/en/men.html.
12. Open below URL to check all the vanity URL’s present:
http://localhost/libs/granite/dispatcher/content/vanityUrls.html
Imran Khan, Adobe Community Advisor, AEM certified developer and Java Geek, is an experienced AEM developer with over 11 years of expertise in designing and implementing robust web applications. He leverages Adobe Experience Manager, Analytics, and Target to create dynamic digital experiences. Imran possesses extensive expertise in J2EE, Sightly, Struts 2.0, Spring, Hibernate, JPA, React, HTML, jQuery, and JavaScript.