Forum Moderators: coopster & phranque

Message Too Old, No Replies

Need subdomain .htaccess

         

BrainGuys

5:28 pm on May 20, 2002 (gmt 0)



Hello!

I urgently need the following .htaccess file:

As my host doesn't automatically support the creating of subdomains, I want to setup a .htaccess file for that. He said, that he can enable for forwarding for *.mydomain.com to www.mydomain.com. Now I need a .htaccess file which regognizes the URL a visitor came from and forwards him to www.mydomain.com/directory.

So when a user types in:

[whatever.mydomain.com...]

He gets redirected to:

[mydomain.com...]

Would be great if anyone of you has this script.

Will this be possible too using .htaccess?

[i.can.write.anything.here.mydomain.com...]

to

[mydomain.com...]

???

Thanks a lot!!!

BrainGuys

5:29 pm on May 20, 2002 (gmt 0)



My provider has set up the DNS that way:

*.mydomain.com goes to www.mydomain.com

So as I am not a .htaccess guru, how can I change the following .htaccess file, so that it works for all subdomains?

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?whatever\.yourname\.com$ [NC]
RewriteCond $1 !whatever/
RewriteRule ^/?(.*)$ /whatever/$1 [L]