I'm on a Hostmonster VPS. I've pointed the A record *.example.com to my server's IP. Here's the main virtual host that's auto-generated by the server:
<VirtualHost 162.144.48.232:80>
ServerAdmin webmaster@example.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/example.com combined
CustomLog /usr/local/apache/domlogs/example.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User <USER> # Needed for Cpanel::ApacheConf
UserDir enabled <USER>
<IfModule mod_suphp.c>
suPHP_UserGroup <USER> <USER>
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup <USER> <USER>
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid <USER> <USER>
</IfModule>
ScriptAlias /cgi-bin/ /home/<USER>/public_html/cgi-bin/
</VirtualHost>
I can append to this in a separate file that gets included after this virtual host definition. I have the following:
DocumentRoot "/home/<USER>/public_html/subdomains/"
<Directory "/home/<USER>/public_html/subdomains/">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost 162.144.48.232:80>
ServerAlias *.example.com
UseCanonicalName Off
VirtualDocumentRoot /home/<USER>/public_html/subdomains/%1
</VirtualHost>
Now, I just put a test "index.html" inside subdomains/test/
. It works fine when I go to example.com/subdomains/test/, but on trying test.example.com, the index.html file loads repeatedly. The same content keeps on repeating and the page never stops loading.
Any hints on why this might be happening?