Okay so I'm running apache 2 with a couple of virtual hosts and 2 of those are running on the same domain. Now my problem is that one of those is suppose to run on a sub domain (dev.domain.com) and the other on everything else but I can't get that to work.
I've got 2 files in sites-available ( dev.domain.com and domain.com ) and both are enabled with symlinks in sites-enabled.
This is what I've got inside the files
dev.domain.com
<VirtualHost *:80>
ServerName dev.domain.com
ServerAlias development.domain.com
DocumentRoot /home/myusername/public_www/dev.domain.com
<Directory /home/myusername/public_www/dev.domain.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
domain.com
<VirtualHost *:80>
ServerName domain.com
ServerAlias *.domain.com *.domain.info
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [R=301,L]
</IfModule>
DocumentRoot /home/myusername/public_www/domain.com
<Directory /home/myusername/public_www/domain.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
So does anyone know what's wrong with my config? I would highly appreciate the help, I've been trying with this forever now with no success.
Note: My actual domain starts with hu so I though dev.h.... would be loaded before the h.... file.