[quote]I admit that some of the stuff you mentioned was gibberish to me.
I have made some progress, but am getting stuck on the rewrite rules. I have successfully redirected the new URL to the old URL and now just need to rewrite.
Here’s the scenario again:
chillisoft.co.za must stay the same
chillisoft.co.za/habanero/* must be habanerolabs.com/*
To pull this off, I redirected habanerolabs.com to chillisoft.co.za/habanero and do the rewrite after that. In my understanding that will work for both people coming in through the new URL and those with links to the old site.[/quote]
I’m sorry, but let’s clarify what you want to happen without being so simplistic.
We know you have two domains - habanerolabs.com and chillisoft.co.za
Now going back to your original post, you said
[quote]So the old domain would be: www.mysite.com/section/somepage
This needs to rewrite to: www.new.com/somepage[/quote]
Which makes it sound as if when visting http://chillisoft.co.za/habanero/somepage you wanted the browser to change the URL in the address bar to http://habanerolabs.com/somepage and you do not want to move any files around.
Now what you have done so far is the opposite direction, where when visiting http://habanerolabs.com/somepage the browser will change the URL in the address bar to http://chillisoft.co.za/habanero/somepage
In case you don’t know this already it needs to be pointed at that you can’t rewrite the hostname. So if you want the hostname to change, you have to have a redirect from the old hostname to the new hostname. This means the browser will always change the URL in the address bar too.
So if you want to do what you said in your original post, you need to do a couple of things.
- Setup habanerolabs.com as a fully-hosted domain with a web directory of /home/username/chillisoft.co.za/habanero/
- Pleace an .htaccess file in /home/username/chillisoft.co.za/habanero
2a. It needs to redirect HTTP_HOST = chillisoft.co.za to http://habanerolabs.com/
2b. It needs to rewrite if necessary (eg, any pages on habanerolabs.com are made by RoR)
You have started off on a different track instead, so please advise which track you want to follow.
Reference: An HTTP URL is scheme://hostname/url-path
Rewriting changes the url-path internally. This is what must happen for RoR to work or to make search engine-friendly URLs for example. You can rewrite the url-path when changing the hostname too, but because the hostname changed the browser will change the URL in the address bar showing both changes.