Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Vanity url is not working with rewrite rule


Level 4

We are trying to make the vanity url works on both publish and dispatcher servers.  Download and installed the VanityURLS-Components package and followed all the steps that documented.


The vanity url is working only when we delete or comment the below rewrite rule

  RewriteCond %{REQUEST_URI} !^/apps

  RewriteCond %{REQUEST_URI} !^/bin

  RewriteCond %{REQUEST_URI} !^/content

  RewriteCond %{REQUEST_URI} !^/etc

  RewriteCond %{REQUEST_URI} !^/home

  RewriteCond %{REQUEST_URI} !^/libs

  RewriteCond %{REQUEST_URI} !^/tmp

  RewriteCond %{REQUEST_URI} !^/var

  #RewriteRule ^/(.*)$ /content/myproject/$1 [PT,L]


But the above commented rewrite rule is required to allow only /content path. Dispatcher filter will reject any request that is not started with /content. With that even etc sling mapping also could not help because the request is not blocked at dispatcher level and not reached publish server.

Is there any other way to handle this without removing rewrite rule?

6 Replies


Community Advisor

One option I can think of is always enable the vanity URL in AEM by appending the full content URL(append the hided path) .e.g append /content/myproject(/content/myproject/vainity1) to enable the vanity path /vanity1( The [PT] rule defined by you in the Apache always append /content/myproject for your vanity URL's (/content/myproject/vanity) so the AEM server match the right vanity defined(/content/myproject/vanity1)

If you follow this option, the VanityURLS-Components configurations are not required - these configurations are enabled only to whitelist the vanity paths in the farm filter.


Albin I


Community Advisor


First of all, the above snippet is used to append the /content/myproject/* path to your incoming shortened urls. Ex: would resolve to: server:port/content/myproject/en/mypage.html. The highlighted part would vary based on project implementation. All other urls would go publish server unless you're blocking them at dispatcher filters.


You can use RewriteRule to redirect your vanity to AEM URLs. 


Whats your exact specific use case? You don't need the vanity urls package.


Level 3

Hi @Anderson_Hamer ,


You could use the /vanity_urls filter to enable the auto filtering for all vanity URLs. Here is the article you could refer to configure this -




Level 4

Yeah but this /vanity_urls filter is not the filtering the vanity URLs that get stored in /temp/vanity_urls file. I could see the vanityURLS in {dispurl}/libs/granite/dispatcher/content/vanityUrls.html


What happens here is, if I hit the vanity URL like - {dispURL}/vanity1, then rewrite rule comes into picture and it is adding /content/myproject/vanity1 and sending a request to publisher, getting 404 page as there is no such page in pub server.


The dispatcher would want to send the same request as vanity like {dispaURL}/vanity1 to pub server then the pub will resolve the url resource and it will server the request. Is there any other way to do this ?


Level 1

Hi @Anderson_Hamer ,


I have a similar kind of issue.Is the above issue resolved?