是否可以获取重定向后使用的个性网址的引用? [英] Is it possible to get a reference to the vanity URL used after redirection?
问题描述
我有一个页面 http:// localhost:4502 / content / project / en / mypage.html
,它的几个虚假URL设置为
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
因此,来自上述两个个性化网址的任何请求都将重定向到 /mypage.html 。
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()
给了我。 ./ mypage.html ,但我需要获取个性网址请求。
request.getRequestURL()
gives me ../mypage.html but I need to get the vanity URL request.
推荐答案
可在HTTP引用标头中找到。您可以按以下方式获取它:
It's available in the HTTP referer header. You can get it as follows:
String referrer = request.getHeader("referer");
这篇关于是否可以获取重定向后使用的个性网址的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!