问题原文
原帖链接 · jackhammer013 · CC BY-SA 3.0
I have an existing redirect rule
location ~* "^/view-price-range.php" {
return 301 $scheme://www.mysite.com.au/pricing/;
}
Is it possible for nginx to detect anchor tag and have a redirect rule?
For example view-price-range.php#mytag
What I want is if that url is being requested it will go to /pricing/ as well.
So tried:
location ~* "^/view-price-range.php#mytag" {
return 301 $scheme://www.mysite.au/pricing/;
}
And not working. I am not sure if the # in the url is being evaluated as comment in nginx?
已采纳解答
原帖链接 · Tero Kilkanen · CC BY-SA 4.0
nginx never receives the part after # in the HTTP request, it is purely a HTTP client (browser) side concept.
This means that the following regexp will match both /view-price-range.php and /view-price-range.php#mytag:
location ~ ^/view-price-range.php$ {
...
}
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
