Web Hosting Talk







View Full Version : htaccess, 301 redirect and subdomain -> question


3-rx
05-20-2006, 07:30 PM
Hello

2 years ago i set 301 redirect(htaccess) from non www version to www version

something like this

RewriteCond %{HTTP_HOST}!^www\.domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

today i need to set up subdomain on this domain, and check that my subdomain is redirected to www.domain.com/subdomain/

hmm ..

is there any way, (may be some additional code to add), and get subdomain.domain.com instead of domain.com/subdomain/

thanks

phearow
05-20-2006, 11:53 PM
i have to post this real quick just so i can post a link for my real reply

phearow
05-20-2006, 11:54 PM
will it not work like this....
RewriteRule /subdomain http://subdomain.domain.com/ [R=301,L]

while_hm
05-21-2006, 08:28 AM
try this code

it doesn't work

3-rx
05-21-2006, 08:34 AM
2 PHEARROW

it cann't work properly as .. first of all all subdomains (like "www.", or "subdomain" in my case) i redirect to www.domain.com