【发布时间】:2021-11-03 07:56:06
【问题描述】:
我有一个主域如下,并且正在使用 Nginix 服务器
子域: https://admin.website.com/
如果有人访问https://admin.website.com/,它需要重定向到https://website.com/ - 我发现以下代码使用了多个服务器的组合(包括带有通配符子域的服务器):
server {
listen 80;
server_name admin.website.com;
add_header Content-Type text/plain;
return 200 "admin";
}
server {
listen 80;
server_name *.website.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 80;
server_name website.com;
add_header Content-Type text/plain;
return 200 "main";
}
但是从子域中,如果有人访问以下url https://admin.website.com/login 和任何后续页面,例如:
- https://admin.website.com/login/useraccount
- https://admin.website.com/login/useraccount/password
- https://admin.website.com/login/password/reset/
- https://admin.website.com/login/password/reset/&hdJ7dHsSJKDJ
等等……
那么它不应该重定向到主域。它应该保留在该子域页面上。有人有什么想法吗?
【问题讨论】:
标签: http nginx httpserver