I wanted to duplicate my WordPress site, and make just a few small changes to the duplicate. However, after duplicating the site, I have had problems with the links sending the user back to the original site. Both the original and duplicate site should function. Here are the steps I have taken:

  1. I duplicated my entire site's WordPress files and placed them in a folder in the public_html directory, where the original site is located.
  2. I made a dump of the original DB and changed all the table prefixes (that were wp_) to newsite_. I did a search-and-replace in the MySQL dump for http://www.originalsite.com to replace with http://www.originalsite.com/newsite. I then imported that edited DB dump into the same database where the original site's DB is.
  3. I opened up wp_config.php and changed $table_prefix = 'wp_' to $table_prefix = 'newsite_'
  4. Realising I couldn't log into the duplicated site, I followed the advice in this stack answer and changed the two key names in newsite_usermeta and newsite_options.

I am able to visit the home page of the duplicated site and I am able to login to the backend. However, all links on the site take the user to the correct page, but on the original site. It is not just the clickable links that are not working correctly, when the desired subpage address is typed into the url bar, the user is again taken to that page on the original site.

Currently the .htaccess file contains:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Do I need to edit this at all?

What steps am I missing in the migration process?

  • Have you changed site_url option? Have you rebuilt .htaccess contents? Have you regenerated permalinks for attachments? – Krzysiek Dróżdż Jul 17 '13 at 11:20
  • Ah it was the permalinks that was the problem - thanks! – tommyf Jul 17 '13 at 11:28

In response to @krysiek's comment above, I simply selected the default permalink setting, saved, then selected correct permalink setting and resaved. Works perfectly.

| improve this answer | |

Wordpress site migration I usually do the following steps:

  • Upload the database.
  • Update the database table wp_options siteurl to new site URL.
  • Upload the website files.
  • Log In to Wordpress Dashboard.
  • Go to Settings and under General Settings edit Site Address (URL) to new site URL.
  • Edit the content of your pages and posts change all url to your new site (source of images and links)
  • If you have custom menus change it also.

I hope that will help you.

| improve this answer | |
  • 1
    Well, if you upload your database it would be easier to edit is as SQL file (you can change all old links to new with simple find&replace). There is no need to do this part in many steps ;) – Krzysiek Dróżdż Jul 17 '13 at 11:32
  • yes agree. you can edit your database directly using any editor even notepad will do. – rolz Jul 17 '13 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.