I was asked to help set up a new web site where a content management system had been installed, and the old content was gradually being copied from the static pages into the database in a piecemeal fashion.

The trouble was, that to get to the old site, users had to click on a small link, which many of them missed, and hence could not get through to the info they wanted. The new site was incomplete, but becuase the C.M.S. has to be installed into the root of the web server, it was what users were getting, instead of the old site.

I took over the job of copying content from the old to the new site, but first I had to make sure that users would get to the old site, whilst I would get to the new site. This seemed hard, given that there was just one web address which had to be able to serve both the old pages to the public and the new pages to me whilst I was working on them.

My first thought was to copy the C.M.S. and database onto my Powerbook laptop, but I did not relish the sort of installation problems caused by different versions of PHP, and I also did not want to have to hack about with the configuration files to change the paths from test-server to production-server.

My second thought was to have a simple re-direct to the directory containing the old files. However, doing this broke the C.M.S. meaning I could not preview any of the pages I was working on. Finally, I hit upon the idea of scanning the web client's IP address, and based on this either redirecting to the old site, or continuing and processing the index page as per the C.M.S.'s internal workings.

The snippet of code I came up with was as follows:

	if ($_SERVER['REMOTE_ADDR']!='82.83.84.85')
	{
		header("Location: oldsite/index.htm");
		exit(0);
	}

...where 82.83.84.85 was the current dynamic-ish IP address assigned by my Internet Service Provider, which I assumed would not change very often.

I inserted this code into the beginning of index.php and there I had it, a web site that I could mess around with at will, without upsetting the all important web-site audience out in internet land.