Replicate your blog on XAMPP in Windows XP

By | August 19, 2007

Those who have self hosted blogs may from time to time decide that they want to tweak the sidebars, adjust the layout, add a widget, or just try out a new theme and see how their blog looks like. Especially for CSS issues, you will likely need a lot of testing and previews to get things right. For that, I can’t imagine life without XAMPP, which makes it possible to even turn a USB flash drive into a mini server.

Today, I’ll talk about duplicating or replicating your WordPress blog on a USB flash drive using XAMPP instead of running a fresh WordPress install. Sometimes you may just want to replicate your live blog because you want to test a theme or change the CSS settings, or install a widget and see how it runs.

  • First step is to deactivate your plugins. You can try not deactivating any plugins, but its best to be on the safe side, because the plugin entries are stored in your database, which can create complications later on. Your live blog may look funny, while this happens, but it will only take 5-10 minutes.

  • In your cPanel, look for the Backup icon. This is where you download your MSQL database. You can also use phpMyAdmin to export your database, but I don’t recommend it for the less technically inclined because phpMyAdmin doesn’t export the format as plain text. In cPanel > Backup, your databases will be listed, so just click on the one you want and download it in zip form onto your PC. After that, dont forget to reactivate your plugins on your live blog!
  • Download your entire live blog and all the WordPress folders and files in the directory where it’s at using cPanel Backup.
  • Assuming you have a XAMPP installation on your USB drive, and the folder is named as xampp, go create a new folder with a name of your choice in htdocs. Lets say – mynewfolder.
  • Unzip your downloaded database, and it will be in database-name.sql format.
  • You can use notepad to open it, uncheck Word Wrap and replace all instances of the former URL with http://localhost/mynewfolder. Make sure that you search and replace ALL instances of your live domain with your new localhost URL. It will take a while, depending on your PC, to search and replace everything.
  • Go your XAMPP installation and open the URL – http://localhost/xampp. On the left hand side of the splash page you’ll see a phpMyAdmin link, so just click it, and once inside your localhost phpMyAdmin, create a new database with the same name as your live database that you have downloaded. Once created, find “Import” and import your downloaded sql database into this blank new one.
  • Create a new user for the database while still in phpMyAdmin; give it the same username and password as your live blog. This is where you need the info from
  • You can copy a fresh WordPress copy into your htdocs folder or use the current one, but the important thing is the Wp-config file needs to carry the same info as the live blog, and so will your localhost database, otherwise you’ll get the message – “Can’t connect to the database.”
  • Go to your new URL – http://localhost/mynewfolder/wp-admin….and log in. Choose the default Kubrick theme (the most stable) for starters, and reactivate all the plugins, and slowly note what works or doesn’t.

Now if you are using [pretty] permalinks on your live blog, you will have problems getting them to work with XAMPP because mod-rewrite is not enabled by default, so…

  • Search for the httpd.conf file inside your XAMPP folder. The path should be something like xampp/apache/conf/httpd.conf
  • Open httpd.conf in notepad and look for the line by using the notepad “Find” function- #LoadModule rewrite_module modules/mod_rewrite.so
  • Delete the # from that line, and then search for another line – AllowOverride None
  • Change only the last instance of that line to AllowOverride All, and leave the other instances as is.

If it helps, here is a full working sample httpd.conf file in text form, so just select all, copy and paste everything into your httpd.conf file, replacing everything. Although I am no tech maestro, I managed to get my blog replicated, so I could work on it offline, so I hope this post is helpful to some of you.

Another alternative to XAMPP is Apache2Triad, which works out of the box when it comes to permalinks, but cannot work on a USB drive. If you don’t mind running apache on your PC, than Apache2Triad is a good alternative to XAMPP.

Share This:
FacebooktwitterreddittumblrFacebooktwitterreddittumblr