In my previous post I mentioned that I’ve moved previous version of this website to a sub-domain. There are a few solutions available to move your WordPress site from one domain to another however I am going to share the fastest and easiest way to do the same.

This solution applies only if you are moving the WordPress install from one domain (directory) to another domain or sub-domain (directory) on the same server.

I’ll refer the existing install as Site 1 and the new install as Site2 below.

Things to check before we start!

  1. To be safe, Make sure you take the backup of the database and all files on your server (including WordPress core files and .htaccess file).
  2. Make sure both domains and database are on same server.
  3. Make sure the new domain or sub-domain is ready to use.

Let’s start with the setup!

Step 1: Updating the links so everything works perfect on new domain or directory.

Login to Site 1 Admin area and go to Settings » General and you will see the following:

Moving WordPress Site from one domain to another

General Settings

Update WordPress address (URL) and Site address (URL) with the new domain location.
For example, you will have http://www.Your-Website.com and you want to move the site to http://new.Your-Website.com, enter http://new.Your-Website.com in both fields.

Click Save Changes button and you will get a 404 page not found error.

Don’t panic, just hit the back button on your browser and you will have the same page in front of you. Do not close this window till the setup is complete.

Step 2: Copying all files from old directory to new directory.

Now we need to copy all the files from Site 1 directory to Site 2 directory. You can do this via FTP or cPanel File manager. I used cPanel as its way too faster than FTP download and upload. Make sure you copy all the files including .htaccess file to new directory to avoid any permalink issues.

Open another browser window and visit Site 2 (e.g. http://new.Your-Website.com). You should have the old site working on a new domain now. Login to Site 2 with your username and password and check the images under Media » Library. All images should be available with new permalinks.

Now you can remove the files on Site 1 and update third party configurations like feedburner.com, Google Sitemaps etc.

I hope this will help in case you plan to move WordPress Install from one domain or directory to another. Please share your solutions in the comments below.

In my next I’ll share how to create a cool Back to Top link with CSS and jQuery as you see at the bottom right of this page.

See you tomorrow!! Cheers!!

  1. Brian on Dec 24, 2011 08:43 am

    This was extremely helpful and truly easy. Gives me another option for development besides changing the hosts file. Thank you!!

    Reply
  2. Mate on Oct 09, 2011 02:06 am

    Thank you, very much time and effort saved.

    Reply
  3. Sadee on Jun 22, 2011 04:48 am

    Is it really this easy? I have created custom wordpress pages in a premium wordpress template. I have special plugins and custom header and everything. Will this work the same for all of that? Everything I have read makes it sounds not so easy.

    Thank you!!

    Reply
  4. Tomas Henri on Apr 29, 2011 10:51 pm

    Nice read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch since I found it for him smile So let me rephrase that: Thanks for lunch!

    Reply
  5. Guru on Apr 11, 2011 10:05 pm

    I have moved many domains, and that method was by far the easiest. As quick as it takes to make a cup of coffee.

    Reply
  6. Ash on Mar 16, 2011 07:55 am

    I’m ideally looking to have a staging area instead of having a duplicate of my original site. Any changes made to site 2 affected site 1 automatically. I’d like to be able to effect site 2 without site 1 changing unless I copy everything back from 2 to 1.

    Thank you.

    Reply
  7. Brandon on Feb 10, 2011 09:14 am

    How do you transfer the database and htaccess file? Where are they located?

    Reply
  8. yudi on Dec 06, 2010 04:22 am

    THANK YOU, mohitaneja! It’s done in less than a minute. God bless you, buddy!

    Reply
  9. Sven Damgaard Ørnstrup on Dec 01, 2010 01:01 pm

    This looks so incredibly easy as opposed to all the other instructions I have found on the web!! Will try it during the weekend …

    Reply
  10. Craig on Nov 07, 2010 11:02 pm

    Can this method be used to ‘duplicate’ an existing site and leave te original site in its original state? (How would I change the URL back to the original step; your Step 1?)
    Basically I have 1 WordPress site set up with posts, pics, plugins, etc. I want to copy it to a new domain, but keep the original also … will this method allow me to do that? Thanks for any help!

    Reply
  11. Luke on Nov 01, 2010 08:17 pm

    I have two domains. http://www.mydomain.com and http://www.my-domain.com

    The difference of course is the –

    My wordpress website is on http://www.mydomain.com and I would like to move it to http://www.my-domain.com. Will the above instructions work?

    Reply
    1. mohitaneja on Nov 22, 2010 06:10 pm

      Yes I tried the same with mohitneja.com and v1.mohitaneja.com..

      Reply
  12. No Vacation Required on Oct 30, 2010 04:38 am

    THANK YOU! Like the other commenters, I have been dreading making this change. I researched, asked on forums and read the Codex pages. Everything said it was easy but none of the instructions actually were easy.

    Your instructions are so straightforward that I had a hard time believing it. everything worked perfectly – the whole switch took 10 minutes, TOPS.

    THANK YOU, THANK YOU, THANK YOU. Why in the hell is this page not showing up number on Google searches!?

    Reply
    1. mohitaneja on Nov 22, 2010 06:25 pm

      Thanks!! I am glad it worked for you :)

      Reply
  13. Michael on Oct 06, 2010 10:39 pm

    I am wondering if this should be the direction I go, the great method you describe or if there is another way. My situation is a little different, I have site A complete, a business site using wordpress, only pages, no posts or comments or anything blog related, approx 130 pages. I have also created site B and C also, same set up, but smaller, approx 30 pages each. But site A has about 80 pages that are exactly what I need on the other two sites. If I could somehow copy these pages to the other sites, it would save me an untold amount of time. Then finally as a huge bonus, when it comes time to update these pages, the same method could be used-just update one site and then copy them all over to the other 2 sites. Any ideas on accomplishing this? I think you might suggest that when starting a new site in the future, say site D, that I just use your method and copy site A and customize from there. I can do that with new sites. But it doesnt help with my two existing or with updating in the future. Any help would be awesome!

    Reply
    1. mohitaneja on Nov 22, 2010 06:33 pm

      According to your situation above method won’t work, Best way would be to play with database and upload folder. Download/Import the wp_posts/wp_postmeta table from all three sites from your server and import them in one database on your local server. This way you’ll have all pages and posts in one DB and then you can simply remove the duplicate posts, there are a few plug-ins to remove the duplicate posts and download the contents from your upload folder and save it on your local server installation.. This way you’ll have all your pages and posts in one db and then you can import the same on any site you want.. Do not delete from your live server until you are sure you have everything on your local installation..

      Reply
  14. Mike on Sep 13, 2010 04:50 pm

    Hey! Thanks, I have been trying to do this for the past hour, my issue was the htaccess file, I forgot to move it so all my pages were giving 404s.

    If youre worried about loosing traffic you can 301 redirect everything.

    Reply
  15. Kathryn Hill on Sep 10, 2010 12:59 am

    This is so awesome – thank you. Effortless.

    Reply
  16. Megan on Sep 09, 2010 03:14 am

    I want to say THANK YOU SO MUCH! I’ve spent all day – literally 12 hours – searching the net and reading the WordPress Codex help pages on how to do this – have tried all sorts of things and was pulling my hair out and wanting to cry.

    Once I found your site I backtracked everything I’d done (editing the .php files and all such) and it literally took 5 mins to have the site moved!!

    YOU ROCK!

    Reply
    1. mohitaneja on Sep 09, 2010 07:44 am

      That’s great!! I am glad it helped.. Feel free to ask if you have any questions in future.. Sharing is best way to increase our knowledge ;)

      Reply
  17. www.ThePankajGupta.com on Aug 19, 2010 11:48 pm

    Wow, I new information.. Thanks for sharing here. But we may loose the traffic if changing our domain?

    Reply
    1. mohitaneja on Aug 20, 2010 02:29 am

      You are correct, however you can always use this method if you ever want to start fresh ;)

      Reply

Leave a Reply