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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Vanity URL working inconsistently

subrato-kha
Level 1
Level 1

Hi All,

 

I am facing weird issue of Vanity url which works for some urls and does not for some of them.

The Urls are unique in the AEM application.

for Example:

https://www.site-A/en/vanity-url-one.html =>sling:vanityPath configured abc.html works when accessed https://www.site-A/abc.html

but another page:

https://www.site-A/en/vanity-url-two.html =>sling:vanityPath configured xyz.html does not works when accessed https://www.site-A/xyz.html

We can see in the error log stating the resource doesn't exists.

Also sling resource resolver resolves the  page https://www.site-A/abc.html  but doesn't resolves the page https://www.site-A/xyz.html

 

I have installed the vanity url component on the publish instance and have configured the dispatcher according to adobe documentations

Also used this link for the setup.

 

Has anyone faced this issue?

 

the problem looks to be how vanity url work along with dispatcher. The vanity url http://localhost:4503/xyz works fine directly on publisher

But the same page over dispatcher url https://www.site-A/xyz  doesnt works, but having https://www.site-A/test-vanity-url-another works fine. 

 

Attaching the error log response, the dispatcher vanity url(https://www.site-A/libs/granite/dispatcher/content/vanityUrls) service response and the configured vanity url

04.08.2020 11:27:19.137 *INFO* [127.0.0.1 [1596533239134] GET /xyz.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /content/site-A/xyz.html not found

 

Screenshot 2020-08-04 at 11.16.53.png

 

 

 

 

 

 

 

 

Screenshot 2020-08-04 at 11.29.55.png

 

 

 

 

 

vhost configuration:

<VirtualHost *:80>
ServerName www.site-A
Header set Host "www.site-A"
<Directory /Users/subrato.kha/dispatcher-cache/site-A>
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>

Options FollowSymLinks
AllowOverride None

# Apache httpd 2.2
# Order allow,deny
# Allow from all

# Apache httpd 2.4
Require all granted
</Directory>
DocumentRoot "/Users/subrato.kha/dispatcher-cache/site-A"
ErrorLog "/private/var/log/apache2/www.site-A-error_log"
CustomLog "/private/var/log/apache2/www.site-A-access_log" common

# Rewrite rules for removing html from extension
# Handle requests to pages ending with a trailing slash
RewriteEngine on

RewriteCond %{REQUEST_URI} !^/content/dam
RewriteCond %{REQUEST_URI} .*/$
RewriteCond %{REQUEST_URI} !^/$
RewriteRule (.*)/$ $1.html [PT,L,QSA]
# Handle requests to pages ending without a trailing slash
RewriteCond %{REQUEST_URI} !^/content/dam/.*
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteCond %{REQUEST_URI} !.*/$
RewriteRule (.*)$ $1.html [PT,L,QSA]

#redirect /file.html to /file
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NE,L,R=301]
</VirtualHost>
1 Accepted Solution
Shashi_Mulugu
Correct answer by
Community Advisor
Community Advisor

@subrato-kha in most cases it should be conflict between your rewrite rules in Apache for adding .html extension to url for supporting url shortening.  Can you please share your rewrite rules as well as logs in debug mode.

Also please refer to below community question for reference 

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/removing-html-extension-at...

View solution in original post

8 Replies
ChitraMadan
Community Advisor
Community Advisor

Hi @subrato-kha,

 

  • Can you please share dispatcher logs.What are you getting in the logs when you are trying to access vanity-url-two.html
  • Is there any rewrite rule which is overwriting vanity-url-two.html to something else
  • Try to check if the problem is in the dispatcher or in publisher
  • Please check access.log in the publisher to check if the request is reaching publisher or not
  • If it is reaching publishers, check your anonymous user permissions

 

 

Shashi_Mulugu
Correct answer by
Community Advisor
Community Advisor

@subrato-kha in most cases it should be conflict between your rewrite rules in Apache for adding .html extension to url for supporting url shortening.  Can you please share your rewrite rules as well as logs in debug mode.

Also please refer to below community question for reference 

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/removing-html-extension-at...

View solution in original post

vanegi
Employee
Employee

hi @subrato-kha,

Do you see the vanity URL which is failing in http://<aem-publish-host:port>/libs/granite/dispatcher/content/vanityUrls.html? This is the service that runs on publisher retrieves the list of vanity URLs available in publish.

 

Thanks!!

subrato-kha
Level 1
Level 1
the problem looks to be how vanity url work internally. I tried the setup again the same page having vanity url xyz.html doesnt works but having test-vanity-url-another.html works fine