Expand my Community achievements bar.

SOLVED

Vanity url not working due to Dispatcher rewrites

Avatar

Level 3

Hi Team,

 

We followed this article https://medium.com/@toimrank/aem-vanity-url-bce73e71d960  to configure Vanity URL.

But it did not work because of Dispatcher rewrite rules. Vanity URLs always get rewritten based on Dispatcher rewrite rules and does not work as expected.

 

E.G. Page A has vanity url something like /abc. 

and  we have rules written at dispatcher level as below:

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} !^/saml_login
RewriteCond %{REQUEST_URI} !^/system
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} !(.html|.jpe?g|.png|.svg)$
RewriteRule ^/(.*)$ /content/mysite/us/en/$1.html [PT,L]

 

PROBLEM:  when we hit url like localhost:4503/abc... It always redirects to /content/mysite/us/en/abc.html and as a result it gives 404.

 

Is there any way to by pass this rewrite rules for all Vanity URLs?

 

Regards,

KTNR

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Dispatcher auto-allow filters is correct way to handle it, if its not working, means there are some problem with your configuration.

 

Alternatively, you can ask editors to setup vanity in AEM with context path as prefix, so instead of setting a vanity "/abc", you should configure "/content/path/to/home/abc"

For end user, there wont be any impact, as they will be able to access /abc

View solution in original post

4 Replies

Avatar

Level 3

@Mohit_KBansal  Thank you for your reply.

 

We have followed all standard procedures also included auto-filter. 

 

When we comment above dispatcher rewrite rules , Vanity works perfectly fine. 

 

So is there anyway to by pass these Dispatcher rewrite rules for all Vanity URL?

Regards,

KTNR

Avatar

Correct answer by
Employee Advisor

Dispatcher auto-allow filters is correct way to handle it, if its not working, means there are some problem with your configuration.

 

Alternatively, you can ask editors to setup vanity in AEM with context path as prefix, so instead of setting a vanity "/abc", you should configure "/content/path/to/home/abc"

For end user, there wont be any impact, as they will be able to access /abc

Avatar

Administrator

@arvindpandey Did you find the suggestion from @Mohit_KBansal 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