I have Apache installed on an EC2 instance (with an Elastic IP). I successfully used NameCheap's DNS tool to configure routing of www.mydomain.com and mydomain.com traffic.

If I have a web application living at www.mydomain.com/MyApp, what steps do I take to route MyApp.mydomain.com traffic to www.mydomain.com/MyApp? I don't want it to be a redirect.

  • DNS is so far out of my comfort area that I don't even know if I should be asking about A, CNAME, or DNAME records. Commented Feb 19, 2013 at 20:24
  • 2
    Out of interest why not 301 redirect? Commented Feb 19, 2013 at 20:54

1 Answer 1


I agree with @bybe. A 301 redirect in your .htaccess file would do the trick.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.