问题
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.
回答1:
You should try to get it from /content/project/page/jcr:content
properties sling:vanityPath
回答2:
It's available in the HTTP referer header. You can get it as follows:
String referrer = request.getHeader("referer");
来源:https://stackoverflow.com/questions/26680812/is-it-possible-to-get-a-reference-to-the-vanity-url-used-after-redirection