cannot get apache2 redirect working for a site
- by benson
what i want to do is to redirect all visitors going to example.com to www.example.com.it seems a very common task but for some reason it is not working for this specific site .it always points to the default one. And strangely, if i replace the domain with another one(yyyyy.com and www.yyyyy.com), it works all right.i check my DNS,and it's resolved to the right IP.
here's my virtual host configure:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example.com
Servername www.example.com
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html/example.com>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost >
<VirtualHost *:80>
ServerAdmin webmaster@localhost
Servername example.com
Redirect 301 / http://www.example.com
</VirtualHost>