Apache2 wildcard subdomains
I've a question to see if it's possible as my search results are turning up empty or with the same blog telling something totally different...
Basically I've added an A Record for *.mydomain.com to my IP... ok, simple stuff over.
Now I've created a VirtualHost which looks something alike:
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias *.mydomain.com
DocumentRoot /home/sites/mydomain.com/htdocs
</VirtualHost>
Now the above is fine for if I want them all pointing to the index.php page. However I'm wanting a little more complex VirtualHost...
The link will look someting alike t开发者_JS百科his:
http://someusername.mydomain.com/public/repositoryname
This would then point to something alike the following:
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias *.mydomain.com
<Location /home/svn/{someusername}/{public}/{repositoryname}>
#Some more code in here...
</Location>
</VirtualHost>
Obviously the Location variables for:
{someusername} - Will be what the subdomain is
{public} - Will be the first GET parameter from the url query string
{repositoryname} - Will be the second GET paramter from the url query string
Now I know this is possibly bending Apache WildCards to the limit, but I need to know if this is achievable or not.
Many thanks, Shaun
I found out how to achieve this by enabling mod_perl and writing a custom perl script. Anyone with a similar issue definately look into using Perl for this!
精彩评论