When I type in my domain name like without the www
(like http://example.com
), it doesn\'t work and gives error message. However, when I add the
With the current version of apache, you need to do the following, which has changed compared to the previous versions:
cd /etc/apache2/sites-enabled
Now find the config file for your domain and edit it (the first three lines after
is what we need here):
ServerName www.yourdomain.com
ServerAlias yourdomain.com *.yourdomain.com
ServerAdmin webmaster@localhost
Options FollowSymLinks
AllowOverride None
And now after saving changes to the file, you should reload Apache we server configuration with:
service apache2 reload
and it'll work!
P.S. You may also want not to add *.yourdomain.com
to the end of your ServerAlias
line.