Forum Moderators: phranque

Message Too Old, No Replies

Redirecting from subdomains

How to redirect for wildcard subdomains?

         

craig1972

1:32 am on Jun 26, 2003 (gmt 0)

10+ Year Member



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!

Birdman

1:17 am on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Options +FollowSymLinks
RewriteEngine on
RewriteRule ^cgi-bin/clients.pl?clientName=(.*)$ h*tp://$1.mydomain.com [L]

Should do the trick...see the apache docs for more mod_rewrite info. Just search for Apache mod_rewrite and you will find it.

delinked

[edited by: Birdman at 1:57 am (utc) on June 27, 2003]

craig1972

1:32 am on Jun 27, 2003 (gmt 0)

10+ Year Member



Birdman, I actually want it the other way around. I mean the subdomain should point to the actual cgi-bin script. Which is the complicated bit and involves DNS perhaps?

bakedjake

1:39 am on Jun 27, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Why did you start another thread?

[webmasterworld.com...]

Birdman

1:52 am on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry about that! Typical for me ;)

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ h*tp://mydomain.com/cgi-bin/clients.pl?clientName=$1 [L]

That would go in the sub-domains .htaccess file. I believe you will need sub-domain priveledges at your host to do what you want.

craig1972

2:04 am on Jun 27, 2003 (gmt 0)

10+ Year Member



baredjake, i had started both the threads together, was not sure if the linux forum was a good place to post because this is not really about linux but about web server. sorry for the confusion, i appreciate your help as well, no doubt!

birdman, what is a subdomain priviledge and the subdomain .htaccess file? can i get it on a shared (virtual) hosting account? if you notice, i do not really have any folders inside my root folder for the subdomain to point to.

i just need the URL pattern of xxx.mydomain.net to point to a cgi-script with xxx as the variable. i realize this cannot be done with simple htaccess in the root folder?

thanks for all your ideas.