Skip to main content

Mirroring your site

Having trouble? Watch on YouTube instead

Making a mirror of your website is not the same as making a backup. When you mirror your website, you download a copy of all of the files that make up your website (images, CSS and JavaScript files), as well as static versions of the HTML. You can easily get people to host this mirror for you. Unlike a backup, it will look just like your website, but it's important to understand that a mirror of your website is not an exact copy. It is a static copy, meaning that you can't do anything dynamic such as log in, edit posts, or post comments.

When you make a mirror of a website you download every single page on the website. For large websites, you might be making hundreds or thousands of requests to the web server, and it may take a lot of time or bandwidth. For small websites it should finish fairly quickly.

GNU wget is a powerful tool for making mirrors of websites. It's a command line program, but it's easy to use. It's available in all major operating systems. The command you need to run looks like this:

wget -mkxKE -e robots=off http://www.example.org/

You will need to change http://www.example.org/ with the URL of your website. All of the options to wget ("-mkxKE -e robots=off") are ideal settings for making a mirror. You can see a full list of options you can use with wget at http://man.cx/wget.

Wget saves the mirror to the folder from which you run it. If, for example, you run wget from your desktop and make a mirror of www.gnu.org, it will create a new folder on your desktop called www.gnu.org which contains all of the files in your mirror. You can open the HTML files with a web browser. The homepage will be called index.html.

Below are more detailed instructions for using wget on different operating systems.

Microsoft Windows

You can download and install wget for Windows from https://sourceforge.net/projects/gnuwin32/.

You will need to open a command prompt from which to run wget on Windows. Opening a command prompt is slightly different in different versions of Windows, but you can generally find it in Start > Programs > Accessories > Command Prompt. Below is a screenshot from Windows 7.

Start out in your user's home folder. In Windows 7, this is "C:\Users\username." In Windows XP, your home folder is "C:\Documents and Settings\username". Type "cd Desktop" and press enter to move into your Desktop folder. This way when you create a mirror of your website it will be saved to your desktop.

Type the following:

"C:\Program Files\GnuWin32\bin\wget.exe" -mkxKE -e robots=off http://www.example.com

In this example, "C:\Program Files\GnuWin32\bin\wget.exe" is the location where you have installed wget. If this does not work, you have installed wget in another directory. Use the path to the directory in which you have installed wget instead of "C:\Program Files\GnuWin32\bin\wget.exe."

If you'd like a GUI alternative to wget, you can use HTTrack

Mac OS X

If you use Mac OS X Snow Leopard or Lion you can download wget from the Rudix repositories. You can download the Mac OS X installer (.pkg file) for wget directly from https://code.google.com/p/rudix/wiki/wget.

Open a terminal window. You can find the Terminal application in Applications > Utilities > Terminal, or by searching Spotlight for "terminal". When you open a terminal in Mac OS X you start out in your home folder, "/Users/username". Type "cd Desktop" and press enter to move into your Desktop folder. This way when you create a mirror of your website it will be saved to your desktop. Here is a screenshot of the command to make a mirror of http://www.example.org:

GNU/Linux

All GNU/Linux distributions should come with wget installed already, since wget is part of the GNU Project. If your distribution doesn't come with wget installed you can install it from your package manager. Here is a screenshot of the command to make a mirror of http://www.example.org:

JavaScript license information