+
80
-

nginx如何实现显性和隐性URL转发?

nginx如何实现显性和隐性URL转发?


网友回复

+
0
-

显性url转发,就是浏览器地址栏中可以看到转发后的新地址

将所有请求重定向到 https://example.com:

server {
listen 80;
server_name example.org;

location / {
return 302 https://example.com;
}
}
将所有请求的 URL 前缀 /old 重写为 /new,并返回 302 重定向:
server {
listen 80;
server_name example.org;

location / {
rewrite ^/old/(.*)$ /new/$1 permanent;
}
}

将请求 /old/page.html 重定向到 /new/page.html,并返回 302 重定向:
server {
listen...

点击查看剩余70%

我知道答案,我要回答