1、修改原域名nginx配置
server {
listen 80 default;
server_name www.111com.net;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/nbhao;
#通过$http_user_agent判断是否是百度蜘蛛
if ($http_user_agent ~* Baiduspider){
return 301 http://www.111com.net $request_uri;
}
#排除对一个网址的301重定向
if ($request_uri !~ ^/.*/.*notify_url.php.*){
return 301 https://$server_name$request_uri;
}
location ~ .*.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
access_log /home/wwwlogs/www.111com.net.log www.111com.net;
}
server {
listen 443 ;
......
#https配置详见
}
2、修改新域名nginx配置
server
{
listen 80;
#listen [::]:80;
server_name www.域名;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/域名/www;
#如果用户不是百度蜘蛛且访问的网址不是baidu.*.html格式
set $flag 0;
if ($http_user_agent !~* Baiduspider){
set $flag "${flag}1";
}
#用做百度站长平台的验证
if ($request_uri !~ ^.*/baidu.*.html.*){
set $flag "${flag}2";
}
if ($flag = "012") {
return 301 https://www.111com.net$request_uri;
}
#接上不,如果是百度蜘蛛,执行proxy_pass反代。
location ^~ / {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($request_uri !~ ^.*/baidu.*.html.*){
proxy_pass https://www.111com.net;
}
}
......
access_log /home/wwwlogs/www.域名.log access;
}
3、通过curl模拟百度蜘蛛、google、普通用户验证
[stocky@s1 ~]$ curl -I -A Baiduspider www.111com.net
HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.15
Date: Wed, 04 Mar 2015 08:59:27 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: http://www.域名/
[stocky@s1 ~]$ curl -I -A Baiduspider www.域名
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 04 Mar 2015 09:01:29 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Vary: Accept-Encoding
X-Powered-By: PHP/5.2.17p1
[stocky@s1 ~]$ curl -I -A google www.111com.net
HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.15
Date: Wed, 04 Mar 2015 09:00:08 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: https://www.111com.net/
[stocky@s1 ~]$ curl -I -A google www.域名
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 04 Mar 2015 09:02:07 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: https://www.111com.net/
[stocky@s1 ~]$ curl -I -A Mozilla www.111com.net
HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.15
Date: Wed, 04 Mar 2015 09:01:59 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: https://www.111com.net/
[stocky@s1 ~]$ curl -I -A Mozilla www.域名
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 04 Mar 2015 09:04:00 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: https://www.111com.net/
测试后发现满足要求。
荒野乱斗国际版 (BrawlStars)最新版本v56.274
下载一波超人内置修改器菜单版 安卓版v1.0.2
下载敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载继承了一座戏园子无限声望铜钱版 内置菜单最新版v1.7
继承了一座戏园子折相思版是游戏的破解版本,在该版本中为玩家提
山河半世橙光清软金手指版 无限鲜花v3.24
山河半世是一款超级好玩的橙光恋爱游戏,在游戏中玩家们需要扮演
蓬莱手游折相思版 安卓版v1.0.0
蓬莱免广告版是游戏的修改版本,在该版本中为玩家去除了广告,玩
当红影后橙光游戏破解版2025 最新版v1.0
当红影后橙光破解版是一款超级好玩的娱乐圈题材的橙光游戏,在这
忽然成了万人迷清软完结版 无限鲜花版v12.15
忽然成了万人迷破解版是一款非常好玩的男性向橙光游戏,在有一天