Vanity URL and Sling Mapping | Community
Skip to main content
Anwar_Sadat
Level 2
Feb 15, 2017 4:25 AM UTC
Solved

Vanity URL and Sling Mapping

I have a few vanity URLs set through the page properties. I have enabled the Dispatchers to recognize the vanity URLs through the /vanity_urls settings in the dispatcher.any.

But the vanity URLs are not resolved because I have a set of sling mappings for different sites:

And this is the one that has the vanity URL mapped to one of its pages:

<sitea.mydomain.com.80 jcr:primaryType="sling:Mapping" jcr:created="2015-07-21T13:03:59.628+08:00" jcr:createdBy="admin" sling:internalRedirect="/content/sitea/home" >
<apps jcr:primaryType="sling:Mapping" jcr:created="2015-07-21T13:03:59.630+08:00" jcr:createdBy="admin" sling:internalRedirect="/apps"/>
<content jcr:primaryType="sling:Mapping" jcr:created="2015-07-21T13:03:59.632+08:00" jcr:createdBy="admin" sling:internalRedirect="/content"/>
<etc jcr:primaryType="sling:Mapping" jcr:created="2015-07-21T13:03:59.633+08:00" jcr:createdBy="admin" sling:internalRedirect="/etc"/>
<homepage jcr:primaryType="sling:Mapping" jcr:created="2015-07-21T13:03:59.637+08:00" jcr:createdBy="admin" sling:internalRedirect="/content/sitea/home.html" sling:match="$"/>
<bin jcr:primaryType="sling:Mapping" jcr:created="2016-05-26T12:11:58.468+08:00" jcr:createdBy="admin" sling:internalRedirect="/bin"/>
<libs jcr:primaryType="sling:Mapping" jcr:created="2015-07-21T13:03:59.635+08:00" jcr:createdBy="admin" sling:internalRedirect="/libs"/>
</sitea.mydomain.com.80>

Now if I remove the above mapping, the redirect works. If I have it, it does not work.

Is there anything that I need to do the sling mapping to make the vanity redirect work?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
vivekanandm17
vivekanandm17Accepted solution
Level 2
Oct 23, 2017 5:33 PM UTC

Hi Anwar,

You should enable "Vanity Path Precedence"  in Apache sling resource resolver factory" From OSGi configuration console. It will ensure your vanity URLs are cosnidered first before the sling mapping.

Best Regards,

Vivek

3 replies

Level 2
Jan 31, 2018 10:17 AM UTC

That also solved the issue for me.

Translate
vivekanandm17
vivekanandm17Accepted solution
Level 2
Oct 23, 2017 5:33 PM UTC

Hi Anwar,

You should enable "Vanity Path Precedence"  in Apache sling resource resolver factory" From OSGi configuration console. It will ensure your vanity URLs are cosnidered first before the sling mapping.

Best Regards,

Vivek

Translate
Level 2
Feb 15, 2017 4:53 AM UTC

I would suggest to handle this on Apache server level. You long URL will be re-direct to vanity URL using 301 redirection. 

 

Let me know if you know further details on this .

Translate