Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an ubuntu apache serveur, with many websites. all my website have the same bug ( so it's look like a misconfiguration)

http://www.2sigma.fr <- it's work fine ( we see "en travaux")

http://2sigma.fr <- dont work, i got 310 error (cyclic redirection!)

here my .htaccess

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

here my confguration

<VirtualHost *:80>
<IfModule mpm_itk_module>
AssignUserId sigma www-data
</IfModule>

    ServerAdmin monmail@gmail.com
    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

If i use this .htaccess it's work fine :

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

I think that it is a apache configuration probleme... but i dont kno how to solve it.

Thanks for your help

share|improve this question
add comment

1 Answer

Try this in your .htaccess:

  RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
  RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
share|improve this answer
    
Hi,thanks for the help but it dont work. both 2sigma.fr and 2sigma.fr show the index.html without any rewriting –  allstat May 30 '12 at 16:24
    
it's look like the rewritecond %{HTTP_HOST} !^www\..+$ [NC] dont match.. –  allstat May 30 '12 at 16:26
    
Did you restart apache to ensure it took effect? –  thinice May 30 '12 at 16:30
    
yes... but no effect. –  allstat May 30 '12 at 17:09
1  
Are you sure there's not other outside influences? You might want to (very briefly) enable debug output to your logs to track the rules being parsed. –  thinice May 30 '12 at 21:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.