Apache - Dynamic DocumentRoot value for wildcard VirtualHost ?


Recommended Posts

Is there a way to define the value of a VirtualHost DocumentRoot based on the return of a cgi script? 

Let me explain, I want to create a wildcard subdomain VirtualHost such as *.mydomain.com. 

When the client goes on any subdomain, it would automaticly run myscript.pl and then, the perl script would return or define the proper DocumentRoot value. 

Is this achievable on apache ? Perl script is only for example, if you have anything else to propose. 

 

Thank you

Link to comment
Share on other sites

wouldn't that just be default page that gets served when server doesn't have a defined virtual host for what was asked for?  From there you can run your script and redirect them to whatever other page you might want by the host header they used to access the default page.

Link to comment
Share on other sites

This topic is now closed to further replies.