cannot get apache2 redirect working for a site
Posted
by
benson
on Server Fault
See other posts from Server Fault
or by benson
Published on 2014-06-01T03:08:35Z
Indexed on
2014/06/01
3:28 UTC
Read the original article
Hit count: 438
apache-2.2
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>
© Server Fault or respective owner