Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^sub.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sub.domain.com$
RewriteRule ^(.*)$ http://www.domain.com/community [R=301,L]
Hello,
I've got this working for a straight redirect of my subdomain. However I don't want it to change the url of my subdomain. What is the syntax for the rewrite to send to the folder public_html/community?
Thanks.
[edited by: jdMorgan at 8:49 pm (utc) on Nov. 22, 2004]
[edit reason] Unlinked example URL [/edit]
RewriteCond %{HTTP_HOST} ^(www\.)?sub\.domain\.com
RewriteRule .* /community [L]
Literal periods in patterns must be escaped by preceding them with a backslash as shown. An unescaped period means "match any character."
Adding the parenthesized sub-pattern "(www\.)" and following it with a question mark to make it optional eliminates the need for a second RewriteCond.
As with your original code, all requests will end up at "/community" including requests for robots.txt, images, css, scripts, etc. I'll assume that's what you want for now.
Jim