One VirtualHost for certain URLs, another VirtualHost for all other URLs in Apache

That's not how it works. A virtual host is based on either IP address or on hostname, not on path. But there are a few other things you can do to achieve the same objective:

  • If the server1 virtualhost has a separate hostname, you could have a redirect
  • If all you want is to serve content from a different path for that URL, you can use an AliasMatch to map that path
  • You could use mod_rewrite to do an URL rewrite according to your specification

I can't be more specific than that without knowing more about what exactly you want to achieve. But I believe the Apache documentation on mapping URLs to file system will give you a good starting point.


Sounds like this could be a job for Apache's proxy module.

Check out the ProxyPass directive:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass