全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 438|回复: 2

请教大佬一个 nginx 跳转规则该怎么写

[复制链接]
发表于 2020-1-3 15:07:28 | 显示全部楼层 |阅读模式
有数百个域名指向一个服务器,当用户通过任意一个 来访域名.com 访问时跳转到: https://mi.aliyun.com/detail/online.html?domainName=来访域名.com

要怎么修改下面规则才能识别来访域名自动跳转呢?

server {
listen 80;
server_name a.com;
if ($host != 'www.a.com') {
rewrite ^/(.*)$ https://mi.aliyun.com/detail/online.html?domainName=来访域名.com$1 permanent;
}
发表于 2020-1-3 15:17:47 | 显示全部楼层
  1. rewrite ^/(.*)$ https://mi.aliyun.com/detail/online.html?domainName=$host;
复制代码
 楼主| 发表于 2020-1-3 15:30:25 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-9 10:40 , Processed in 0.103103 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表