Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

we have a backup of our site in another linux hosting. the backup is setup as from the cpanel. but there is no domain name assigned to it.we access the backup site by adding the ip address and hostname in the hosts file.

Now we want to display when a user types for one hour without modifying the DNS.

How to redirect the request for to ?

Note:we have another live website in the backup hosting ip address and there is no domain name pointing to the backup site

Hope somebody knows the answer

share|improve this question

migrated from Jan 8 '10 at 10:16

This question came from our site for professional and enthusiast programmers.

By "another linux hosting" do you mean that the site is on a completely different machine/location? – Joel L Jan 8 '10 at 10:15

Use .htaccess instead to avoid the PHP overhead.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$$1 [R=301,L]
share|improve this answer
Just a note that you should only use 301 (last line) if you intend this to be a permanent change. Otherwise you should use 307. – Michael Mior Jan 8 '10 at 15:29

There is not really an automatic way of getting this to work, however, you could simply add a PHP script to to redirect to

Something like this:

<?php header('Location:'); ?>

share|improve this answer

Your question is a little unclear.


  • and are on the same local machine.
  • has a public ip address
  • does not have a public ip address but does have an entry in the /etc/hosts file on the local machine.
  • your web server is Apache.


  • temporarily serve from

With the given assumptions, I would suggest using mod_proxy or mod_rewrite with the proxy extension.

Example 1:

Serve from vhost using mod_proxy

<VirtualHost *:80>

    ProxyRequests off
    <Proxy *>
        Order deny,allow
        Allow from all

    ProxyPass / retry=0
    ProxyPassReverse /

Example 2:

Serve from vhost using mod_rewrite

<VirtualHost *:80>
    RewriteEngine on
    # The RewriteCond isn't necessary, but allows some flexibility.
    # If the file exists - redirect requests, otherwise do nothing.
    RewriteCond /var/www/redirect-reqs -f
    RewriteRule ^/(.*)$$1 [P]

Hope this helps.

share|improve this answer

agy, is in a different linux hosting server , all other assumptions are correct. the ip of this server currently host another using http://ip will show that one

share|improve this answer

Your Answer


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