0

I have a page http://localhost:4502/content/project/en/mypage.html and it has couple of vanity URLs set as

/content/project/vanity-1
/content/project/vanity-2

So any request from the above two vanity URLs are being redirected to /mypage.html.

Is it possible to get the vanity URL request from where the page is redirected to? i.e how can I find from which vanity URL the request is coming from?

request.getRequestURL() gives me ../mypage.html but I need to get the vanity URL request.

anotherdave
  • 6,656
  • 4
  • 34
  • 65
stdio.h
  • 126
  • 3
  • 15

2 Answers2

0

You should try to get it from /content/project/page/jcr:content properties sling:vanityPath

Sabya
  • 1,419
  • 1
  • 10
  • 14
0

It's available in the HTTP referer header. You can get it as follows:

String referrer = request.getHeader("referer"); 
Mohit Bansal
  • 384
  • 3
  • 12