Forum Moderators: phranque

Message Too Old, No Replies

Can't get subdomain with htaccess

Need help setting up subdomains with htaccess

         

carrie

4:22 am on May 30, 2002 (gmt 0)

10+ Year Member



I am trying to get a subdomain working using my .htaccess file with no success. I have several stacked domains that respond just fine but I can't get subdomains to work for my main site or the stacked domains. I've tried the little I could find for .htaccess file subdomain setup but nothing seems to work.

An example of code that works for my parked domains is:
RewriteCond %{HTTP_HOST} ^.*parked1\.com$
RewriteRule ^(.*)$ /parked1/$1

Any clue as to how to get a subdomain such as me.parked1.com to work? By the way, I checked with my host and they have DNS wildcards enabled.

Brett_Tabke

4:28 am on May 30, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Welcome to the board.

Try putting your third level domains ahead of the other domains in the list and use the "L" switch for last.

RewriteCond %{HTTP_HOST} ^foo.parked1\.com$
RewriteRule ^(.*)$ /parked1/foo/$1 [L]

RewriteCond %{HTTP_HOST} ^bar.parked1\.com$
RewriteRule ^(.*)$ /parked1/bar/$1 [L]

RewriteCond %{HTTP_HOST} ^.*parked1\.com$
RewriteRule ^(.*)$ /parked1/$1

I think what is happening, is that the stock "parked.com" is being activated ahead of the thrid level domains.

You do have some sort of wild card dns setup right? Where the 3rd level is passed to your site? Most filter it.

http://foo.webmasterworld.com

That gets filtered and rejected at the dns level by the host, and there is never an opportunity for us to grab the host name.

carrie

2:08 pm on May 30, 2002 (gmt 0)

10+ Year Member



I tried your suggestion and it didn't work. I've contacted my hosting company again to verify the dns wildcard is working. I passed along your example to show them the problem I am having. I'll be sure to post the final solution.

carrie

5:30 pm on Jun 5, 2002 (gmt 0)

10+ Year Member



Ok. I found out the problem is with my hosting company. They recently moved me to new servers that do not have wildcard dns enabled yet. Brett, they also verifed your suggestion would work if wildcard dns was enabledd.