I'm working with Virtualhosts and a local catch-all domain TLD and I need 3 use-cases to work simultaneously, but so far, I've only been able to get two to work at a time.
I need for three different test domains to be able to access their respective document root.
Case 1: test1.dev --> /path/to/www/SomeFolderName (an override using it's own unique folder name and virtualhost file)
Case 2: *.dev --> /path/to/www/%0 (full url including .dev, so test2.dev points to /path/to/www/test2.dev )
Case 3: *.dev --> /path/to/www/%1 (full url excluding .dev, so test3.dev points to /path/to/www/test3 )
So, I need two wildcard situations for any domain like test2.dev or test3.dev, use VirtualDocumentRoot "/path/www/%0" if it exists or VirtualDocumentRoot "/share/www/%1" if that exists instead.
Right now, either case 2 or case 3 works depending what is loaded first, but not both at the same time. How can I have 1 catch all domain select only the existing document root?
It's not really supported to have Apache change the document root based on whether or not the directory actually exists. I think you will have better luck standardizing the document roots so that they are all
/share/www/testX.devand creating symbolic links from/share/www/testX.devto/share/www/testXwhen necessary. You could even create the symlinks from a custom 404 handler.