Vanity urls on publisher goes 404 | Community
Skip to main content
New Member
July 13, 2023
Solved

Vanity urls on publisher goes 404

  • July 13, 2023
  • 2 replies
  • 1355 views

Hi Team,

 

We are creating pages programatically on publisher it self, and setting sling vanity urls. We have observed that few pages working fine but few of them goes 404.

Path pattern is 

Content path is : /content/myproject/products/product-categoty/product.html

Vanity path is : /content/myproject/product.html

 

I have checked the error logs on publisher.

GET /content/myproject/vivoy128gb-storagegold-8gbram.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource/content/myproject/vivoy128gb-storagegold-8gbram.html not found

When we travers page through crx/de repository to actual page "/content/myproject/products/product-categoty/product.html" and performed dummy save operation same page started working.

Also another behaviour is after few day's same page went 404, without any content update or any other operation. Then again need to do the same practice.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by bilal_ahmad

Hello @vb_dev First off - why are you creating pages on publish server? I mean the usual approach could have been : create pages on author and then publish it - so that in case you mess up, you can do something about it. If you mess up here - there's very little you can do.

Anyway, second point - 

Resource/content/myproject/vivoy128gb-storagegold-8gbram.html not found

Can you check if you are appending "Resource" with content path by any chance while resolving the pages?


Thanks

-Bilal

 

 

 

2 replies

bilal_ahmad
bilal_ahmadAccepted solution
Level 5
July 13, 2023

Hello @vb_dev First off - why are you creating pages on publish server? I mean the usual approach could have been : create pages on author and then publish it - so that in case you mess up, you can do something about it. If you mess up here - there's very little you can do.

Anyway, second point - 

Resource/content/myproject/vivoy128gb-storagegold-8gbram.html not found

Can you check if you are appending "Resource" with content path by any chance while resolving the pages?


Thanks

-Bilal

 

 

 

VB_DevAuthor
New Member
August 30, 2023

If we hit actual content path then page load fine on publisher, but same page we hit through vanity url goes 404.

After digging found that below query only traverse 1 lacks node and my case more than 2 lacks pages with vanity urls present.

 

SELECT sling:vanityPath, sling:redirect, sling:redirectStatus FROM nt:base WHERE sling:vanityPath IS NOT NULL

 

 

bilal_ahmad
Level 5
September 8, 2023

Ah! that was the culprit.

If you have not implemented a solution yet, I'd suggest you create a custom oak: index definition.

 

Thanks

-Bilal

Tanika02
Level 7
July 14, 2023

Hello @vb_dev  - 

 

Couple of things here : 

  • I would suggest creating pages first on author (maybe, programmatically as you mentioned) => Page Activation (to publish env)
  • The logs which you have shared above are they that of publisher/dispatcher? As, if you are accessing pages via dispatcher/CDN node caching might have to do something here.