转自:http://blog.csdn.net/xingfujie/article/details/7337832

需求:nginx规则,所有对OA.bccom.info的访问,redirect到uc.qycn.com,谢谢。
◆ 写法:
server
   {
   listen 80;
   server_name uc.qycn.com;
   index index.htm index.php;
   root  /export/home/www
   if ($host = "oa.bccom.info"){
   rewrite ^/(.*)$ http://uc.qycn.com/$1 permanent;
    }
}

【符号注释】
^ 匹配字符串的开始
/ 匹配域名的分隔符
. 匹配除换行符以外的任意字符
* 重复零次或更多次
(.*) 匹配任意字符
.* 匹配任意文本
$ 匹配字符串的结束

相关文章:

  • 2021-05-25
  • 2022-01-04
  • 2022-03-08
  • 2021-08-02
  • 2021-08-27
  • 2021-05-15
  • 2021-10-01
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
相关资源
相似解决方案