如何在 Nginx 中重写当前 URL?
How to get current rewrited URL in Nginx?
这是我的 nginx 配置文件:
http {
index index.html;
server {
server_name www.domain1.com;
access_log logs/domain1.access.log main;
root /var/www/domain1.com/htdocs;
rewrite ^(/upload/banner/\d+/).+\.(\d+m?.(jpg|png))$ last;
# How to get current rewrited URL now? With echo module?
....
....
}
你可以看到我在里面重写了
现在如何重写当前 URL?使用 echo 模块?
你能给我解释一下吗?
最新的 URL 将包含在 $uri
变量中。
$uri
current URI in request, normalized
The value of $uri may change during request processing, e.g. when doing >internal redirects, or when using index files.
这是我的 nginx 配置文件:
http {
index index.html;
server {
server_name www.domain1.com;
access_log logs/domain1.access.log main;
root /var/www/domain1.com/htdocs;
rewrite ^(/upload/banner/\d+/).+\.(\d+m?.(jpg|png))$ last;
# How to get current rewrited URL now? With echo module?
....
....
}
你可以看到我在里面重写了
现在如何重写当前 URL?使用 echo 模块?
你能给我解释一下吗?
最新的 URL 将包含在 $uri
变量中。
$uri current URI in request, normalized The value of $uri may change during request processing, e.g. when doing >internal redirects, or when using index files.