Partial Domain Forwarding / Redirection

Hi experts,

Our website was built using Ruby on Rails, and we need to recreate it very quickly in a LAMP environment on a different server (Server B) which does not support ROR.

The site consists of a majority of content that can be recreated in static html and can be setup on
the new server in a relatively short space of time..

The site current has the following structure on Server A
-> News
-> Forum
-> Photos
-> Profiles

Our plan is to recreate a. News b. Forum c. Photos statically on the new server and migrate across the dns records to point to this new server..

What we need to happen is if the user goes to or etc it will be served from Server B however if the user goes to it will be served from the OLD server (Server A) with in the browser address bar..

Is this possible via domain forwarding / redirection?

Would appreciate your help urgently on this one..

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you setup Server B with a sub domain of with all the folders it requires, such as

When someone attempts to go to they're automatically forwarded to

You could do this with PHP or HTACCESS, PHP would be:



Save that as index.php in the folder and they'll be sent to the new server automatically.

If you REALLY want to maintain the in the location bar, you would probably have to use HTML frames, which I personally would steer clear from.
moconnAuthor Commented:

Thanks for your response..

Not sure if that would work entirely as we want users to be able to type in and get the news page on Server B

People would know that they have to enter to access it..
You are right in as much as they would SEE in their location bar, but they will always be able to type in and they'll always be redirected to regardless.

They would never need to type into their location bar, the forwarder would always take care of that.

The only other option I can think of, if you are using Apache, is you could write some mod_rewrite rules, however this is fairly complicated! I've provided a link to the Apache 1.3 manual below if you want to read more about it:
You will have to use two different domain names to distinguish between servers.  DNS does not provide routing based on sub-directories.

You could use sub-domains like this:

Each of those domains could point to different IP addresses.

If you don't want to change your URLs at all, you can use PHP includes.  Suppose the new server is and the old server is  Create a file on www named news/index.php with this single line in it:

<?php include ''; ?>

Warning: Make sure PHP.ini has allow_url_fopen enabled.  Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote files via this function, even if allow_url_fopen is enabled.

You will have to create a similar file for every other URL that you want to mirror from to  My example just gets the default file (like 'index.html').

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.