0

I'm sure there's a name for this and I'm probably just searching wrong. Anyways, is it possible to set up virtual hosts on the same domain name by using information after the '/'

For example

host1 => example.com/siteA/

host2 => example.com/siteB/

It might be helpful for me to mention that my goal is to host PHP content on siteA and mod_wsgi content on siteB (I'm using flask).

I just want to separate all of the back-end configuration settings using virtual hosts. Perhaps I'm thinking of this the wrong way and there's a more proper manner of doing this sort of thing.

  • It's much, much better to use subdomains in this scenario. Trying to use subdirectories gets very complicated and error-prone very fast. – Michael Hampton Feb 3 '14 at 1:50
1

No, virtual hosts don't work that way. You can use them to set up siteA.example.com and siteB.example.com, but not example.com/siteA and example.com/siteB.

However, you can still accomplish it by using a structure like this:

# global configuration
<Location /siteA>
    # siteA configuration
</Location>
<Location /siteB>
    # siteB configuration
</Location>

Most of the directives that can go in a vhost configuration can also go in a <Location> section, so I don't think there are many limitations to setting things up this way. Check the allowed Context of the directives you want to use in the Apache docs to be sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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