Apache2configuration,.htacces和310错误(wwwredirect)

我有一个Ubuntu的Apache的服务器,与许多网站。 我所有的网站都有相同的错误(所以它看起来像一个错误的configuration)

http://www.2sigma.fr < – 它工作正常(我们看到“en travaux”)

http://2sigma.fr < – 不工作,我得到310错误(循环redirect!)

在这里我的.htaccess

Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^2sigma\.fr$ RewriteRule ^(.*) http://www.2sigma.fr/$1 [R=301,L] 

在这里我的configuration

 <VirtualHost *:80> <IfModule mpm_itk_module> AssignUserId sigma www-data </IfModule> ServerAdmin [email protected] ServerName 2sigma.fr ServerAlias www.2sigma.fr DocumentRoot /home/sigma/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /home/sigma/www> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error_sigma # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access_sigma combined ServerSignature Off 

如果我使用这个.htaccess它工作正常:

 Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^2sigma\.fr$ RewriteRule ^(.*) http://www.google.fr/$1 [R=301,L] 

我认为这是一个Apacheconfiguration问题…但我不知道如何解决它。

谢谢你的帮助

在你的.htaccess中试试这个:

  RewriteCond %{HTTP_HOST} !^www\..+$ [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]