Replicate your blog on XAMPP in Windows XP
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.




This info was just what I needed.
I want to set up a mirror copy of my live website on my PC using XAMPP.
The bit I’d not figured out was “replace all instances of the former URL with http://localhost/mynewfolder” in the .sql file.
Never would have worked that bit out.
Hi
Me again.
One of your points says…
“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 ”
Should that read… from the wp-config file.
Thanks
Hi Keith,
Yes, the info should be the same as the wp-config file.
Thanks Darrin
I’ll let you know how it goes.
Hi Darrin
Almost there.
Site loads but when I click on individual posts or pages I end up at the XAMPP splash screen.
I use pretty permalinks so I used your “full working sample httpd.conf file”
Path to my httpd.conf file was as you said… xampp/apache/conf/httpd.conf
Any suggestions.
Hi Keith,
Can you get a simple test blog (not a copy of your own live blog) set up and working on your local host?
Hi Darrin
I changed the pretty permalinks back to default… and links to pages and posts are now working.
As you said in your article… this site will be for testing plugins etc so the non pretty permalinks is no big deal.
I’ll also use it for writing posts without eating up my bandwidth.
Only thing not working is my Contact form 7 plugin – can’t get it to send email.
Thanks for your help and encouragement – never imagined that I could export and install a database using phpMyadmin.
Hi Keith,
Your computer/server won’t be able to send email through Contact 7 because it’s not a recognized mail server, but I believe it can be done with some tweaking
Maybe something changed with Xampp. The Xampp copy on my USB can definitely change permalinks to pretty permalinks, but it’s the same copy as the one I’m using on the page.
Anyway I’m glad that you got your blog working; the most complicated part is exporting/importing the database.
Hi Darrin
“Your computer/server won’t be able to send email through Contact 7 because it’s not a recognized mail server, but I believe it can be done with some tweaking”
Any idea what the tweaking is or where I can find the info?
I hate to be beaten.
The database in phpMyadmin is a bit scary but on a local install it doesn’t matter if it goes horribly wrong.
Hi Keith,
I haven’t tried modifying my server to send emails, but I’m sure if you searched on Google, you’ll find pages telling you how to do it.