Forum Moderators: bakedjake
I have a script for extranet access that is like this:
[mydomain.com...]
I want to set up a rewrite rule that will allow
[<clientName>.mydomain.com...]
to be pointed to the above path automatically.
How can I set this up?
Thanks!
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.mydomain\.com(.*) http://mydomain.com/cgi-bin/clients.pl?clientName=$1 [R,L] BTW - Use PT instead of R in the parameters if you want it to be transparent.
<Edited: Typo>
Tell them that you need a wildcard DNS entry that points *.mydomain.com to your IP address. It should be a simple one-line addition to their DNS configuration.
Then use the rewrite formula above - it will sort out the header name and send them to the right place.
If they won't add it for you, find a webhost that will.