Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有使用 If 从 Nginx 配置文件中的变量中提取值的替代方法?
IE
if ($http_referer ~* (?<=url=)([\w-.]*)(?=/) ){ set $proxied $1; rewrite (?<=/)(.+\.(css|jpg|png|gif|js)) http://$proxied/$1 redirect; }
谢谢
是的。http://nginx.org/r/map
map $http_referer $proxied { default example.com; "~*(?<=url=)(?<p>[\w-.]*)(?=/)" $p; }