Wildcard DNS: DirectoryIndex breaks for subdomains


Sep 26, 2006
Alright, here's the setup: I've got *DNS enabled on two servers. On one, I hacked the httpd.conf and replaced

ServerAlias domain.com

ServerAlias *.domain.com domain.com
On the other, I simply added * as a subdomain through cPanel (after realising I could actually do that. Handy trick, that.)

Now, server 1 (the hacked httpd.conf server) is the one I used to be on, and I had a fancy little subdomain setup that leveraged mod_rewrite to redirect something.domain.com to domain.com/subdomains/something. This works on both servers just fine. The problem, though, is this:

In my .htaccess file for domain.com, I have this:

DirectoryIndex index.php index.html /draw_index.php
So this basically gets rid of those hideous Apache indexes. Simple stuff, really. However, on the new server with the * subdomain, it doesn't work.

http://user.domain.com/ shows this error:

The requested URL /subdomains/user/draw_index.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Wait, what? /subdomains/user/draw_index.php isn't where it should be looking... It SHOULD be looking in /.

It works FINE if I go to http://www.domain.com/subdomains/user/.

My question is this: Why does the other server work fine, and not this one? The only difference is in the way *DNS is setup, and I cannot figure out why it's suddenly confusing the root for subdomains.

Sorry if this was confusing! I'll do my best to clarify upon request. Thanks in advance for any suggestions.
Last edited: