Auto Redirect

Hi all.

I’m about to move an entire site from one domain to another, all within dreamhost.

I want to create a page at the old site that will show up whenever anyone tries to access any page from the old site. I want this page to explain that the site has been moved to the new site, and automatically redirect the browser to that new site after a five second delay.

I know that I can create a page missing.html at the old site, and then remove all pages from that domain so that trying to access any page from the old domain will generate a 404-not found error, and then presumably automatically load my custom missing.html page.

So I can put whatever info I want on that missing.html page. But can I also have that page automatically reroute the browser after a five second delay? Not sure how to do this one.


hmm you can use a .htaccess file to point it all to the html with the redirect meta tag + explanation, dunno how out of my head tho

Save $97 with the [color=#CC6600]97BUCKSNOW[/color] promocode


Being less enlightened, how exactly do I use that command? In the head of a page, with brackets or without… what’s the exact way to use it?

Thanks for the patience with those of us who just don’t get it yet.

That is a PHP command, which is one way to approach it. If you are more comfortable with html:

will do the trick. Place this within the section of your page.


Great, thanks. That works. I’d like to know how to use the PHP command too.

Another problem I’m finding, however, is that my original site is php and it doesn’t generate a 404-not found error when trying to access a bogus page, instead it generates a page reading No Input File Specified.

So my strategy of using a custom missing.html page to catch any attempt to access any page at the original site doesn’t work, if the attempted page is php.

Any thoughts? Thanks.

Here is a strategy that will do what you want:

  1. In you “old” site’s “base” web accessible directory (http://oldsite.tld) place an .htaccess file containing the following line:

RedirectMatch 301 ^/ http://newsite.tld/moved.html

  1. On your “new” site, create “moved.html” containing the meta-refresh as described above.

You are done! Irrespective of file type, any requests coming to “oldsite.tld” will be redirected to “newsite/moved.html”, where you can display whatever you want, and then send them where you wish.

Note to other readers: This will not work to redirect requests to a page on the same domain where the .htaccess file is placed - you will get an “endless loop” :wink:


header(“refresh: 5;”);

Site Moved

Thank you for visiting, but our site has moved to a new domain name.

You will be redirected in 5 seconds, if not click here