how to: whatever.domain.com

how to: whatever.domain.com

Post by Joh » Sat, 19 Dec 1998 04:00:00



I'm using Apache 1.2.4 and I'm trying to figure out
how to use one IP address and have it redirect
all www.domain.com calls and domain.com calls
to one DocumentRoot and all other calls (whatever.domain.com) to a
script using a different DocumentRoot value.

No matter what I do to the httpd.conf file, it doesn't
work.  Right now it's like this:

<VirtualHost domain.com>

DocumentRoot /web/guide/domain/HTML
ServerName webpost.net
ServerAlias www.domain.com
TransferLog /web/guide/domain/file.log
</VirtualHost>            

<VirtualHost domain.com>

DocumentRoot /web/guide/cgi-bin/domain-cgi/jump.cgi
ServerName *.domain.com
ServerAlias *.domain.com
</VirtualHost>

I read some place to try taking off the last > on the beginning
VirtualHost's but that didn't work either.

My purpose is to have anything other than www. forward to the
script, and then the script will forward the correct subdomain that
was called to a new directory on the server.


Thank you

 
 
 

how to: whatever.domain.com

Post by Joshua Sliv » Sat, 19 Dec 1998 04:00:00



> I'm using Apache 1.2.4 and I'm trying to figure out
> how to use one IP address and have it redirect
> all www.domain.com calls and domain.com calls
> to one DocumentRoot and all other calls (whatever.domain.com) to a
> script using a different DocumentRoot value.
> No matter what I do to the httpd.conf file, it doesn't
> work.  Right now it's like this:
> <VirtualHost domain.com>

> DocumentRoot /web/guide/domain/HTML
> ServerName webpost.net
> ServerAlias www.domain.com
> TransferLog /web/guide/domain/file.log
> </VirtualHost>            
> <VirtualHost domain.com>

> DocumentRoot /web/guide/cgi-bin/domain-cgi/jump.cgi
> ServerName *.domain.com
> ServerAlias *.domain.com
> </VirtualHost>
> I read some place to try taking off the last > on the beginning
> VirtualHost's but that didn't work either.
> My purpose is to have anything other than www. forward to the
> script, and then the script will forward the correct subdomain that
> was called to a new directory on the server.

Ackkk.... Have you looked at the docs?  As far as I know ServerName
doesn't take wildcards and and I'm not sure whether you can have a
file name in your DocumentRoot.  Also, do you have a NameVirtualHost
directive?

It sounds to me like what you are trying to do could be better
accomplished by using mod_rewrite.

--
Joshua Slive

http://finance.commerce.ubc.ca/~slive/