Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Jeromy French Feb 19 '13 at 20:24
Out of interest why not 301 redirect? – Simon Hayter Feb 19 '13 at 20:54

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]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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