Help with moving and duplicating WP sites (probably a databse issue)

6 replies
Hello to you great programmers


I want to create different versions of a WordPresss website and put them in different URLs. I want to be able to sell them too.

After I've downloaded the site files and the database, I do these steps for the new URL:

1. I upload the site files

2. Create a new database, add the username with all privileges

3. I open the file 'wp-config.php' to edit these 5 lines

define('DB_NAME', 'yourdatabasename'); /** The name of the database for WordPress */

define('DB_USER', 'yourdatabaseusername'); /** MySQL database username */

define('DB_PASSWORD', 'yourdatabasepassword'); /** MySQL database password */

define('WP_SITEURL', 'yourBlogURL'); //Change this to your blog URL including http:// but excluding the last forward slash '/'.

define('WP_HOME', 'yourBlogURL'); //Change this to your blog URL including http:// but excluding the last forward slash '/'.

The last two settings overrides the URL address in the wp-options of the phpMyAdmin. I went in to change nonetheless.


4. In the phpMyAdmin, I import the database into my newly created one


I thought I'd be all set. When I look at the new site online, everything seems fine BUT the blog posts all open in the original URL, not the new one. When I add new posts inside the wp-admin, all is fine until I go to view them, I get a Error 404 message. Obviously, I still link somehow to the original URL.

What is my way out of this?

Thanks!!!!
#databse #duplicating #issue #moving #sites
  • Profile picture of the author mattalways
    I think there are more values in the phpmyadmin mysql database that need to be updated. Look carefully I'm not certain but I think there is another value that needs updated in options.
    Signature

    Quit wasting your money! If you need a website, get me to do it right! I'll probably even do it for less! Design/Development/Software, I'm your guy! matt@snidge.com
    {{ DiscussionBoard.errors[1595864].message }}
  • Profile picture of the author Jay Rhome
    You're probably right but I can't find what else. In the wp_posts I see that the original URL is there inside the post data, but I'm sure changing them one by one is NOT the solution!
    {{ DiscussionBoard.errors[1596163].message }}
  • Profile picture of the author Richard Pickett
    Originally Posted by Jay Rhome View Post

    Hello to you great programmers
    Hello!

    Originally Posted by Jay Rhome View Post

    I thought I'd be all set. When I look at the new site online, everything seems fine BUT the blog posts all open in the original URL, not the new one. When I add new posts inside the wp-admin, all is fine until I go to view them, I get a Error 404 message. Obviously, I still link somehow to the original URL.
    Wordpress stores the website name in the "options" table - if your word press table prefix is "wp_" then the options table is "wp_options".

    look for option_name "siteurl" and "home".

    WARNING!!!!

    Even when you update the options here, if you have plugins installed and configured they may have made modified copies of the domain name in other fields in your database. In phpmyadmin when you are looking at the "database" level (where you can see all the tables listed on the right side, you can click the "search" tab and enter your site name (just domain.com) and "select all" the tables and do the search, then edit each location where the site name comes up if necessary.

    I admit, what you're wanting to do isn't really straight forward. I run wordpress. I'm a php programmer of 8 years, I write mysql queries with 10+ joins and subqueries.

    Do I do it this way (copy one install for other sites)? No. I run a lot of wordpress sites and setup new ones all the time for new customers. About once a month I adjust the list of default plugins I install, either taking one off the list or adding one to the list. That complicates a straight copy. Most of the options for the plugins I use are different for each site (tying in someone's twitter/facebook/etc accounts into their own site), making for a complicated straight copy. I have 100+ templates the site owner can chose from, after which I have to go setup their widgets (they usually can't do that). That would complicate a straight copy. I edit their template php/html to suite their specialized header/footers as necessary, this would complicate a straight copy.

    In the end it's just easier to do a full new install each time, takes about 30 min and I know I've gone through everything needed for their site.

    I do have a script that I run that downloads the latest wordpress tgz, unzips it in the new account's home folder, re-links www/public_html to point to the wordpress, copies over all the templates, and then chown (change owner) on the files to the new user so all I have to do is use cpanel to create the database/account/password and go to their site and plug that into the config. Then I start installing all the plugins and configuring them. So I like automation, but I think wordpress and it's plugins are too complicated to safely automate the entire setup.

    Good luck!
    Signature
    Mastering Email Delivery
    Have (or want) a large list and want to ensure delivery and eliminate spam reports?
    Inbox me
    {{ DiscussionBoard.errors[1596200].message }}
  • Profile picture of the author Jay Rhome
    Hi Richard. I'm glad to give you your first THANKS.

    Maybe it's indeed a plugin causing this issue. Mmmm.

    I have bought "ready made sites" right here on the forum, and installed the sites doing these steps. Takes less than 5 minutes, and there's no need to even install WP. I want to provide the same for my future customers.
    {{ DiscussionBoard.errors[1596279].message }}
    • Profile picture of the author Richard Pickett
      Originally Posted by Jay Rhome View Post

      Hi Richard. I'm glad to give you your first THANKS.

      Maybe it's indeed a plugin causing this issue. Mmmm.

      I have bought "ready made sites" right here on the forum, and installed the sites doing these steps. Takes less than 5 minutes, and there's no need to even install WP. I want to provide the same for my future customers.
      Thanks for the "thanks" Jay. (is there a way you can see who/where you were thanked?)

      I can see why you want WP to do the quick install, maybe if you don't have a lot of complications from plugins you'll be ok.

      I know for sure you have to replace the values in the options table.

      Good luck!
      Signature
      Mastering Email Delivery
      Have (or want) a large list and want to ensure delivery and eliminate spam reports?
      Inbox me
      {{ DiscussionBoard.errors[1596367].message }}
  • Profile picture of the author Jay Rhome
    OK here's I finally solved the problem. I was missing ONE TINY step.

    That was saving the Permalinks in the Settings area...

    I didn't think it mattered since I saw the SEO friendly /%postname%/ already there...

    I certainly is a necessary step!!! It is the step for all the inner links to point to the current site.

    Once you know it is so simple. Till you find out, it's hair pulling for hours... I hope this post saves someone a few hours of frustration!
    {{ DiscussionBoard.errors[1598454].message }}

Trending Topics