Products and Services
Find the right tools for your business. Select the right components and build the perfect web site.
It is pretty simple to copy all of the files to a subdirectory. If your URLs are hard-coded and absolute then a quick search and replace with almost any editor can change http:www.mysite.com/ to http:www.mysite.com/mirror/.
Many content management systems and ecommerce packages such as osCommerce will offer a configuration file or setting where you can edit this once for the entire website.
If your links are scattered across many files and various database tables you may find it easier to capture the output in a buffer and searching and replacing at that point; the benefit here is that your database records will remain untouched and easier to copy over to the live website either piecemeal or in their entirety.
You can buffer output in PHP using ob_start and the related family of buffering functions as in this example from PHP.net.
function callback($buffer)
{
// replace all the apples with oranges
return (str_replace("apples", "oranges", $buffer));
}
ob_start("callback");
?>
<html>
<body>
<p>It\'s like comparing apples to oranges.</p>
</body>
</html>
<?php
ob_end_flush();