Here is my apache default configuration for virtual host
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options +FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/mydir">
AllowOverride FileInfo Limit Options Indexes
</Directory>
<Directory /var/www/>
Options Indexes +FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
This works well for http://mydomain.com but not for http://www.mydomain.com How to serve my domain with www ?
This problem is only for default domains, my other domains work for both with this config file
<VirtualHost *:80>
ServerName otherdomain.com
ServerAlias www.otherdomain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/otherdomain
ServerSignature Off
<Directory />
Options +FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/otherdomain>
Options Indexes +FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/otherdomain.com_access.log combined
ErrorLog /var/log/apache2/otherdomain.com_error.log
</VirtualHost>