I have a virtualhost that is forwarding to my main domain (e.g. showing the same content that my main domain shows).
Right now my site uses a main domain:www.example.com
And various alias domains:example.comshort.com
I'm creating a new walled garden development site:dev.example.com
But my virtualhost isn't being recognized for that url.
Do I have to create a wildcard record for *.example.com in my DNS host or something?
Here is the pertinent section from my default virtualhost settings (currently in /etc/apache2/sites-enabled/000-default
):
<VirtualHost *:80> ServerAdmin webadmin@example.com ServerName www.example.com ServerAlias example.com ServerAlias shortUrlEx.com ServerAlias www.shortUrlEx.com RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301] RewriteCond %{HTTP_HOST} ^shortUrlEx.com [NC] RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301] RewriteCond %{HTTP_HOST} ^www.shortUrlEx.com [NC] RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301] DocumentRoot /var/www/examplepath php_value date.timezone "America/New_York" php_value expose_php "Off" php_value upload_max_filesize 10M php_value post_max_size 10M... other config options
And dev.example.com is configured as follows (from /etc/apache2/sites-enabled/dev.example.com
):
<VirtualHost *><Directory /> AuthType Basic AuthName "Check Site" AuthUserFile /srv/dev-example/config/.htpasswd Require valid-user</Directory> ServerName dev.example.com DocumentRoot /srv/dev-example/public_html/ Alias /favicon.ico /srv/dev-example/docs/dev_favicon.ico php_value date.timezone "America/New_York" php_value expose_php "Off" php_value upload_max_filesize 10M php_value post_max_size 10M<Directory /> Options FollowSymLinks -Indexes AllowOverride None</Directory><Directory /srv/dev-example> Options FollowSymLinks MultiViews -Indexes AllowOverride All Order allow,deny allow from all</Directory> ... further options that shouldn't be applicable...
What am I doing wrong here? How should I configure the default and dev.example.com virtualhosts to allow access to the dev subdomain and use the main domain for everything else?