是否可以使用If从Nginx配置文件中的变量中提取值?
即
if ($http_referer ~* (?<=url=)([\w-.]*)(?=/) ){
set $proxied $1;
rewrite (?<=/)(.+\.(css|jpg|png|gif|js)) http://$proxied/$1 redirect;
}
由于
答案 0 :(得分:5)
map $http_referer $proxied {
default example.com;
"~*(?<=url=)(?<p>[\w-.]*)(?=/)" $p;
}