Making Website Changes on a Copy of a File Instead of the Original

When making major changes to a website, working on the "live" version of the file may be problematic. For example, if you've been performing updates for a while only to discover that you're heading in the wrong direction. Having the original file provides a safeguard in case there's a need to go back to the drawing board. The original file is also useful for making those quick updates which crop up before the larger renovations are done. So let's look into duplicating pages for updates.

Who the Post Is For

Before getting too far, it worth saying that this post is geared towards those who manually manage their website files. If you use a Content Management System (CMS), there's probably a built-in feature for maintaining multiple copies of a page as changes are made. Now on to the topic at hand.

The Example

Let's say we need to update the staff page for an organization. The employee information is currently hard-coded into the page and we want the content to be pulled from a database. Before performing the updates, we'll duplicate the staff page.

Duplicate File: Same Directory

As with most things involving computers, there are multiple ways to duplicate files. The original file could be opened in Adobe Dreamweaver, for example. Then use the Save As feature to create a file with a different name. We could locate the file on the hard drive and duplicate it with copy/paste. Or maybe we're using a magic wand…in the end we just need a way to get two files (ex: "staff.php" and "staff2.php"). Then we can modify "staff2.php" to utilize the database.

To see the changes, we upload the new file and manually type the address (ex: But what if the page being updated needs to be connected to other pages to function properly? We could modify all the pages so they work together on a test server…or we could save the duplicate file with the same name as the original.

Duplicate File: Different Directories

For more integrated pages, it may be more efficient to work on a file that's named the same as the original. For example, if the page we're editing displays resources based on criteria sent via the POST method, there may be several links/forms connecting to that page. We could modify all those connections on the test server, but it might be quicker to use the same file name for the duplicate file.

Of course, two files with the same name can't be stored in the same directory. Instead we'll create a directory for the files being modified. We just need to remember to move the file back when we're done.

Note: we might want to archive the old page before moving the updated file into the "live" directory. But we can talk more about that next week (Archiving Old Code after Major Updates).


There are currently no comments.

Leave a Comment