I have a cPanel server setup with a domain that has several subdomains whose document roots are within the parent domain:
Document roots:
domain.com : /home/domain/public_html
sms.domain.com : /home/domain/public_html/sms
I want to redirect anyone who goes to www.domain.com/sms to end up at http://sms.domain.com
I have rules like so:
RewriteRule ^sms(\/.*)?$ http://sms.domain.com$1 [R]
Going to domain.com/sms results in a hang up. I turned on rewrite logging and nothing shows in the log. It is as if it is stuck in an infinate loop.
For a test, I wrote this rule:
RewriteRule ^blahblah(\/.*)?$ http://google.com$1 [R]
/blahblah doesn't exist as a directory or file. This rule works just fine and ends up at google.com.
Obviously, Apache doesn't like the fact that there are these other subdomains setup within the parent domain when it is trying to match the rewrite rules. I tried turning canonicalname off also to no avail. Any tips on how to get this done? It doesn't have to be with rewrite if that helps (any method works fine for me!)