Partial Domain Forwarding / Redirection

Posted on 2006-04-05
Last Modified: 2012-06-27
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..

Question by:moconn
    LVL 2

    Expert Comment

    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.

    Author Comment


    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..
    LVL 2

    Expert Comment

    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:
    LVL 6

    Accepted Solution

    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').

    Featured Post

    Javascript: Crash Course

    Javascript is not only emerging as the most important language to know, it's flexibility is unique. With Javascript being deployed on the web, mobile and even the desktop this is the one language that all technologists need to know.

    Join & Write a Comment

    Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
    Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
    This video teaches users how to migrate an existing Wordpress website to a new domain.
    Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now