[TriLUG] Quacks like a duck, but looks like a... (mod_rewrite)

Brian Henning brian at strutmasters.com
Thu Aug 18 10:41:08 EDT 2005


Hi Folks.

Someone other than me set up the company website a good while before I 
came onboard and documentation is very scarce.  I'm running into some 
weirdness with the way Apache is configured concerning virtual hosts.

We have a subdomain, chrysler.strutmasters.com .  Our httpd.conf has a 
virtual host directive for it, like so (sorry for the wrapping):

<VirtualHost chrysler.strutmasters.com www.chrysler.strutmasters.com>
     ServerName chrysler.strutmasters.com
     ServerAdmin webmaster at strutmasters.com
     DocumentRoot
       usr/masked/path/to/chrysler.strutmasters.com/htdocs
</VirtualHost>

and of course, ~/usr/masked/path/to/chrysler.strutmasters.com/htdocs 
exists and has stuff in it.

Thing is, that stuff isn't what comes up when you go to 
chrysler.strutmasters.com.  If chrysler.strutmasters.com is in the 
request at all, it's an automatic redirect to:

http://www.strutmasters.com/chrysler/index.htm

Which is great!  That's exactly what I /want/ to happen!  Only problem 
is, I don't know /why/ it's happening.  There's nothing in the vhost 
files to cause a redirect that I can see (no meta refresh, no scripted 
location headers, nothin').  It's clearly being done before the vhost 
directory is consulted, because even if I specify 
chrysler.strutmasters.com/index.html (which is nothing but a bare "under 
maintenance" placeholder page), it still redirects as explained above.

....but there's also no mod_rewrite, or anything else that I can see, in 
httpd.conf.  How else can this be made to happen, where a subdomain 
automatically redirects to a particular location in a domain's directory 
structure?  In DNS, chrysler.strutmasters.com is just an alias for 
strutmasters.com .

I ask at all because 1) I want to know how to work with it and change it 
if the need arises, and 2) I'm about to create canada.strutmasters.com 
as a real vhost and I want to make sure it is going to work correctly.

Thanks, everyone!

Cheers,
~Brian Henning



More information about the TriLUG mailing list