0

I am trying to make a redirect for a subdomain but i can't figure it out. This what I have now:

RewriteCond %{HTTP_HOST} ^(mysubdomain).myhost.com$ [NC]
RewriteRule (.*) http://www.myhost.com/folder/index.html [R=301,L]

But when I go to the subdomain address in my browser, there's no redirect.

I need this for only one specific subdomain. Where am I going wrong?

Gumbo
  • 643,351
  • 109
  • 780
  • 844
rjjonker
  • 73
  • 1
  • 9
  • Maybe this helps: http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www And check that mod_rewrite available. – ZloyPotroh Feb 10 '12 at 10:56

2 Answers2

0

Try this, since you only need it from one domain. The () are pointless in both cases. Especially on the 2nd line where you aren't passing the old URL to the new URL.

RewriteCond %{HTTP_HOST} ^www.old-domain.com$ [NC]
RewriteRule ^.*$ http://www.myhost.com/folder/index.html [R=301,L]
thenetimp
  • 9,487
  • 5
  • 29
  • 42
0

Should be:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC] 
RewriteRule ^.*$ http://www.domain.com/folder/ [R=301,L]