Redirect HTTP requests based on subdomain address without changing accessed URL?

Posted by tputkonen on Server Fault See other posts from Server Fault or by tputkonen
Published on 2010-04-08T14:09:11Z Indexed on 2010/04/10 20:13 UTC
Read the original article Hit count: 398

Filed under:
|
|

Let's say I have a domain, www.mydomain.com.
And I ordered a new domain, abc.newdomain.com.

Both domains are hosted in the same ISP, so currently requests to either of those addresses result in the same page being shown.

I want to redirect all requests to abc.newdomain.com to folder /wp so that when users access abc.newdomain.com they would see whatever is inside folder /wp without seeing the URL change.

Questions:

  1. How can I achieve this using .htaccess?
  2. How can I prevent users from accessing directly /wp directory (meaning that www.mydomain.com/wp would be blocked)?

© Server Fault or respective owner

Related posts about apache

Related posts about htaccess