产品服务AMH 免费服务器主机面板SSL证书 免费SSL证书申请 担保单 免费安全、零费率交易平台编程助手免费智能写代码、翻译AMYSQL 免费MySQL管理工具

AMH 社区首页

 AMH社区 - 开放自由有价值的社区

[求助帖] 301 的问题,求帮助

loveolddhb
铁牌会员
63.00 价值分

loveolddhb 发表于 2014-03-20 11:26:22
错误 310 (net::ERR_TOO_MANY_REDIRECTS):重定向过多。

我用了这段代码

[*]if ($host != 'www.xxx.com') {
[*] rewrite ^/(.*)$ http://www.xxx.com/$1 permanent;
[*]}

就显示上面那段话了,我直接用带www.xxx.com访问网站会自动跳回xxx.com的,是不是这个原因?要怎么设置
评价: 这个问题有价值吗?  没有 (0分)   有, 感谢 (0分)
2014-03-20 11:26:22 1

amysql
创始人
99532.51 价值分

上面代码没问题。
更改规则后,在AMRewrite模块那边做下Nginx配置检测。
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2014-03-20 11:33:13 2

AMH面板 - 好用高效低占用、安全可靠极稳定

loveolddhb
铁牌会员
63.00 价值分

引用:
amysql 发表于 2014-3-20 11:33
上面代码没问题。
更改规则后,在AMRewrite模块那边做下Nginx配置检测。


location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
if ($host != 'suwo.me') {
rewrite ^/(.*)$ http://www.suwo.me$1 permanent;
}

}
上面是我配置信息

[正确] Nginx配置Rewrite规则校验成功。 [AMRewrite-1.0 admin] [OK] AMRewrite-1.0 is already installed. nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

然后就是访问suwo.me 出现http://www.suwo.me/index.php 的网页生成了 过多的重定向。清除此网站的 Cookie 或允许第三方 Cookie 可能会解决该问题。如果 不能解决,可能是服务器配置有问题,而不是您的 计算机有问题。
以下是一些建议:
请稍后重新加载此网页。
详细了解此问题。
错误 310 (net::ERR_TOO_MANY_REDIRECTS):重定向过多。
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2014-03-20 14:45:55 3

amysql
创始人
99532.51 价值分

引用:
loveolddhb 发表于 2014-3-20 14:45
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;

if ($host != 'suwo.me') {
rewrite ^/(.*)$ http://www.suwo.me$1 permanent;
}

应该是$host != 'www.suwo.me'
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2014-03-20 15:12:09 4
 1  (总1页)
AMH社区列表
用户服务中心