长沙网站seo收费,微网站菜单,博客wordpress主题,c语言开发网站教程static 模块提供了root与alias功能#xff1b;发现目标是目录时#xff1b;但URI末尾未加/时#xff1b;会返回301重定向#xff1b;重定向后会加/ 指令 Syntax: server_name_in_redirect on | off;# 控制返回那个域名
Default: server_name_in_redirect off;
Context: ht…static 模块提供了root与alias功能发现目标是目录时但URI末尾未加/时会返回301重定向重定向后会加/ 指令 Syntax: server_name_in_redirect on | off;# 控制返回那个域名
Default: server_name_in_redirect off;
Context: http, server, location
Syntax: port_in_redirect on | off; #控制返回的端口
Default: port_in_redirect on;
Context: http, server, location
Syntax: absolute_redirect on | off; #返回重定向时时否添域名默认是会添域名
Default: absolute_redirect on;
Context: http, server, location配置 [rootpython vhast]# cat dir.conf
server {server_name www.dir.com fwe.dir.com; #第一个为主域名第二个为辅助域名server_name_in_redirect off;listen 8088;absolute_redirect off;root html/;
}测试 [rootpython vhast]# curl www.dir.com:8088/first -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.15.9
Date: Wed, 10 Jul 2019 10:30:04 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
Location: /first/修改配置 server {server_name www.dir.com fwe.dir.com;server_name_in_redirect off;listen 8088;#absolute_redirect off;root html/;
}测试 [rootpython vhast]# curl www.dir.com:8088/first -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.15.9
Date: Wed, 10 Jul 2019 10:31:21 GMT
Content-Type: text/html
Content-Length: 169
Location: http://www.dir.com:8088/first/
Connection: keep-alive测试加主机名 rootpython vhast]# curl -H Host:aaa localhost:8088/first -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.15.9
Date: Wed, 10 Jul 2019 10:34:36 GMT
Content-Type: text/html
Content-Length: 169
Location: http://aaa:8088/first/
Connection: keep-alive修改配置 [rootpython vhast]# cat dir.conf
server {server_name www.dir.com fwe.dir.com;server_name_in_redirect on; #表示修改为主域名在返回的URI里listen 8088;#absolute_redirect off;root html/;
}测试 [rootpython vhast]# curl -H Host:aaa localhost:8088/first -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.15.9
Date: Wed, 10 Jul 2019 10:36:46 GMT
Content-Type: text/html
Content-Length: 169
Location: http://www.dir.com:8088/first/
Connection: keep-alive转载于:https://www.cnblogs.com/rdchenxi/p/11171349.html