3

I use bluhost web hosting.

I already have mysite1.com. I want to copy this website to different domains within the same hosting, eg. mysite2.com, mysite3.com, and so on. All sites will have the same content as mysite1.com.

How can I do it in fastest possible way ?

1
  • Have you considered using a domain alias? If the sites are 100% identical, then why do you need 3 different domains? You can just use an alias and adjust WP's rewrite rules. Commented Jan 22, 2013 at 15:38

3 Answers 3

2

Steps are as follow:

  1. Copy the root folder of mysite1.com, in your case folder is mysite1.

  2. Paste it in the root of your hosting and rename it as mysite2.

  3. Go to MySql database of mysite1.com and export the data.

  4. Create another database, mysite2data and import the data to this database.

  5. Now goto mysite2 -> wp-config.php. Open the file.

  6. Now change the following details

    /** MySQL database username */
    define('DB_USER', '**mysite2 username**');
    
    /** MySQL database password */
    define('DB_PASSWORD', '**password**');
    
    /** MySQL hostname */
    define('DB_HOST', '**mysite 2 database path**');
    

And you are ready to go.

3
  • I am trying that Commented Jan 3, 2013 at 16:21
  • And what about the Media links for mysite2.com and mysite3.com when mysite1 is shut down. Will the settings in the wp-config.php override the values in the DB?
    – Jack G.
    Commented Jan 5, 2013 at 1:07
  • 1
    @ j.gonzalez It will not. This answer is specific to cloning a WordPress site (multiple installs, one database). Migrating a site from domain1.com to domain2.com is a slightly different proposition and requires a couple of extra steps to make sure all URLs and file paths are changed in the database.
    – JCL1178
    Commented Jan 6, 2013 at 7:27
1

I use a free WordPress plugin, Duplicator, for cloning my live site for testing purposes. It'll backup the entire mysite1.com directory structure (you can exclude whatever dirs/files that you want) and it'll backup the entire database, too.

Unfortunately it doesn't allow for backup/restore of only certain database tables. It handles the search/replace of your database, i.e., any hard-links. So you run Duplicator from your site1.com admin, download/upload the backup created by Duplicator to your new (must be empty) folder for mysite2.com. Or, you could use SSH to do the copy much faster than downloading it to your computer then uploading it to the new dir.

Once you've got the backup to your desired folder, just go to mysite2.com/installer.php and Duplicator prompts you for the new database details (remember, Duplicator needs a blank db to restore to, or you can force it to overwrite an existing db).

It's actually simpler than it sounds.

Edit: You didn't mention if your hosting allows you to point different domains to different directories. If it doesn't, let me know. It's easy via .htaccess to handle the redirects. I use GoDaddy's Economy plan, which allows unlimited domain addons but they all point to root. I use .htaccess to point all of my different domains to their respective directories.

Here's a step-by-step:

  1. if using a caching plugin, clear the cache and turn it off during the backup
  2. backup with Duplicator
  3. if using SSH, copy (or move) the following two files:

    site1.com/wp-snapshots/xxxxxxx_package.zip
    site1.com/wp-snapshots/xxxxxxx_installer.php (rename to installer.php in destination directory)
    

    to your site2.com root directory, e.g., public_html/site2/. Duplicator also creates a standalone MySQL backup file, but you can ignore it since the database is also saved in package.zip

  4. If not using SSH, you can move the above files via FTP, or download via Duplicator's interface the package.zip & installer.php to your computer and upload via FTP.
  5. in your browser, go to site2.com/installer.php
  6. a Duplicator form will appear. Leave the 'Settings' section as is
  7. enter your new database details (click 'Test Connection' if desired)
  8. checkmark 'I have read...' and click 'Install'
  9. follow the simple directions on the page that appears and you're done!

Duplicator takes care of the WP backend stuff like changing the site url in admin, fixing any hard-coded links that point to site1.com in your database, etc. It reminds you to clear your cache if you're using a caching plugin.

0

Download all the files from mysite1.com via FTP and upload them to mysite2.com or mysite3.com - it should take no longer than a few minutes.

2
  • I did it , even I export db to newly created database for each site , but it is not working Commented Jan 3, 2013 at 15:13
  • Sidh's answer is far more descriptive than mine and should answer your question Commented Jan 3, 2013 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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