I would like to know what I have to add to the apache.conf file to achieve the following:

  1. For all requests for which no Virtualhost is specified, they have to go to one of the Virtualhosts that I do have specified (but I don't want to use ServerAlias, because there are too many domains which I would have to list). And I also don't want to use the ErrorDocument 404 option, because I already use it.

  2. a request on the direct IP of the webserver will do a redirect to an URL on another server (now I use a php redirect, with an index.php in the www root)

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

The first virtual host you specify is the default one used in case no other host alias matches. You could use mod_rewrite to match the requested host to see if it is the IP address in question and use a RewriteRule to send them to your desired destination.

link|improve this answer
Thank you, I did not realize that the first virtual host is the default one used in case no other host alias matches. Furthermore I created one virtualhost with Servername & Serveralias the hostname and ip-adress. All together resulted in what I was looking for. Thanks. – ICTdesk.net Aug 4 '11 at 18:35
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.