Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a client with a site at subdomain.example.com/folder.

I've cloned it locally in MAMP. Once I've made some changes, I need to host it at an alternative physical server (I intend to use a dedicated server I have access to with a technical domain name currently). However, the client would like to keep the existing URL as it has been used extensively in marketing.

I've done HTTP redirects and forwards and 301 redirects in the past, but I'm not sure how or even if I can do what the client wants. How can I achieve this, possibly using .htaccess and DNS entries?

Caveats: I can't have the site at a 3rd party domain and the client isn't able/allowed to register any additional domains.

share|improve this question

migrated from superuser.com Jul 11 '12 at 4:09

This question came from our site for computer enthusiasts and power users.

    
So you just want to host the contents of the subdirectory on the new server while subdomain.theirdomain.com still points to the current server (without changing DNS entries)? –  Mathias Jul 9 '12 at 12:10
    
"I can't have the site at a 3rd party domain and the client isn't able/allowed to register any additional domains" - So register it for them. But can't you simply redirect the traffic using javascript? I know this is possible since I have done it on my own domain I have hosted with the horrible service known as GoDaddy –  Ramhound Jul 9 '12 at 17:54
1  
I'm confused. If they want to keep the existing URL, why aren't you just putting the updated site back where it's already hosted? There's a bunch of talk about putting it on a new server and whatnot, but no explanation for why the new server even comes into play. (Beyond that, if I'm reading things correctly you can probably do this with a CNAME, I'm just not following why the problem exists at all.) –  Su' Jul 11 '12 at 9:49
add comment

2 Answers 2

You can use a file called as .htaccess stealth redirection in order to redirect your website using the .htaccess.

The code for the same is:

RewriteCond %{HTTP_HOST} ^(www\.example\.com)?$
RewriteRule ^(.*)$ http://example.com/subfoldername/$1 [P,L]

In case, you wish to host the subdomain on a different server then, you will have to add an A record pointing the subdomain to the IP address of the new server.

I am a bit confused regarding the question and will really appreciate if you can point out the exact requirements.

I have answered the question as per my understanding. Feel free to correct me in any case.

share|improve this answer
add comment

Just update the DNS records for the whole site?

If it's for a folder only, you can add a redirect script based upon the URL?

You have a few comments which I think you need to answer before any one can help.

share|improve this answer
add comment

Your Answer

 
discard

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