繁体   English   中英

网页有一个重定向循环www到非www

[英]Webpage has a redirect loop www to non-www

我在debian 7上安装了lamp,但现在我需要一个非www网址,我的网站总是添加www。 之前

ServerAdmin webmaster@localhost
ServerName www.example.com (the same issu with example.com)
ServerAlias example.com *.example.com
DocumentRoot /home/site/www
<Directory />
        Options FollowSymLinks
        AllowOverride All
</Directory>
<Directory /home/site/www>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

我也用htaccess测试,但浏览器给我循环

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

为什么要添加www? 它的新配置我只启用了一个站点。

谢谢

确保域example.com实际上通过DNS解析(而不仅仅是www.example.com

如果无法解析域,现代浏览器(以及不太现代的浏览器)将尝试自动更正域。

除其他外,这意味着他们将尝试在www.添加前缀www. 域名。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM