Redirect/Rewrite Subdomain to Subfolder

Posted by Laurent Ho on Pro Webmasters See other posts from Pro Webmasters or by Laurent Ho
Published on 2011-05-07T06:02:18Z Indexed on 2012/11/08 23:18 UTC
Read the original article Hit count: 259

Filed under:
|
|
|

I'm trying to redirect a subdomain to a subfolder e.g. forums.domain.com to www.domain.com/forums

Note that I started the forums in the subfolder format but worried that members might mistakenly try to access the forums using the subdomain format.

RewriteCond %{HTTP_HOST} ^(www\.)?forums\.domain\.com
RewriteRule .* /forums [L]

From what I read the codes above should work through .htaccess, but do I still need to create a DNS A record to point to the IP address of the server?

© Pro Webmasters or respective owner

Related posts about redirects

Related posts about htaccess