Often you need to move your blog from www.domain.com to www.domain.com/test. You might want to test something and does not want to interfere with your blog. A way to do this is by creating a clone of your blog in subfolder. So how do you do it? Assume that your blog is at www.domain.com, here’s how:
- Download database backup plugin from http://www.ilfilosofo.com/blog/wp-db-backup.
- Activate the plugin
- Backup your database using your plugin. Go to ‘Manage’ -> ‘Backup’ menu. Choose ‘All tables’ and download the backup file to your computer. You will get a zip file with .sql file in it.
- Extract the .sql file
- Backup the .sql file. You can just copy the .sql file to another folder
- Open the .sql file using notepad.
- Replace ‘http://domain.com’ with ‘http://domain.com/test’
- Create a new wordpress blog at sub folder i.e. www.domain.com/test
- Loggin into your phpmyadmin. You usually can find your phpmyadmin at cpanel.
- Click databases, and select the database that you will be importing your data into.
- Across the top of the screen will be a row of tabs. Click the Import tab.
- On the next screen will be a Location of Text File box, and next to that a button named Browse.
- Click Browse. Locate the .sql file stored on your computer which you have modified using notepad.
- Make sure the SQL radio button is checked.
- Click the Go button.
- You should now have a new blog at http://domain.com/test.
- Contact me if you have any problem.
- If you have huge database, you might want to reduce the size so you can import small database. What makes the database that huge is usually your post. So in order to reduce the size, you need to delete some post in the .sql file. Open the .sql file and search ‘wp_posts’ word. Find something like : “INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_category`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES
This is the command to insert data to your database. So you need to remove the
( x,x,x,x,x,x,x,x,x,x,x,x,x,x,x). To see the difference download this zip file, and compare the two files. The old.sql will insert two data, while the new.sql will only insert one data.