Grow your CSS skills. Land your dream job.

Moving WordPress from Localhost to Subdomain to Root of site.

  • # August 3, 2012 at 6:48 pm

    Essentially what I want to do is move my site to a subdomain (test.mydomain.com) so I can test some things. After that I would then need to place it on the root of my site (mydomain.com). Possible without screwing things up?

    # August 4, 2012 at 12:10 am

    100% possible, just make sure to keep backups of before, during and after and you shouldn’t have to worry about a thing.

    http://codex.wordpress.org/Moving_WordPress

    http://interconnectit.com/124/search-and-replace-for-wordpress-databases/

    # August 4, 2012 at 10:21 am

    One of the best features of Dreamweaver is its site manager. Even without it, its not too difficult to create a zip of your entire site, then move it to your testing server. If you set up a subversion server (or app), you can keep track of the changes you make.

    # August 4, 2012 at 10:51 am

    I think I’ve used Dreamweaver for about a day. I have to say I’m not a fan of anything it offers. I use ST2. I’m not too skilled in development or if at all in the backend so I usually just read tutorials on these types of things. Appreciate the help from everyone.

    # August 4, 2012 at 1:31 pm

    You could always export all your WordPress content as an xml file, and import it on a fresh install on your website if nothing else works.

    # August 5, 2012 at 12:42 am

    I’m assuming from how you are writing that out you are simply moving sequentially: localhost > test domain > live.

    If that’s the case, you can pretty quickly do this with just changing 2 values in the mySQL database and then using something that TheDoc hooked me on called Velvet Blue’s update URL’s plugin.

    Basically, you’ll go on your test.domain and install a fresh copy of wordpress. Then go to your localhost and export the mySQL database. Then go into your test.domain and import it to your new fresh mySQL database that was put in place when you installed WP. Go into the mySQL manager and then navigate into the WP_Options table and change two values (home address and site admin) – you’ll see them – they are the only two in there with a full URL. Just change that to your test.domain. Install Velvet Blue’s Update URLs and then use it to change all your images, posts, excerpts, etc.

    Then once are ready to go live and make all your changes and it’s how you want it, go into the WordPress dashboard and under “General” change the URL there to the new one you will move it to. Grab your files and move them to the root. You can then log into the WP dashboard again and then run Update URLs for the last time and you’re pretty much golden.

    # August 5, 2012 at 12:46 am

    Oh one thing to mention is that you’ll need to make sure the info in your wp-config.php has the right info in it. It will most likely be different from the localhost version, so just change that file once you’ve imported the database to your test domain.

    # August 5, 2012 at 12:58 am

    Thank you for the tutorial, @JoshWhite. Much appreciated and easier than I thought.

    # January 1, 2013 at 3:43 pm

    Hi. I am trying to make a test site on wordpress. I have a created a subdomain. I want to keep my current website live so that I can work on the new one without any problems. I want to move from WPEC to Woocommerce and also change my theme. There is an extension that I can use to export all my products from WPEC to Woocommerce so I need a replica of my website put onto my subdomain so that I can do this. I have imported my current sql database to the test domain and I have also uploaded all of my WP Content files to my subdomain. I followed the steps above set out by @joshwhite for changing the options tables etc… The problem is that none of my info has come into my test site. It’s all as if it’s a brand new installation still. None of my products are there or anything. The theme is like the original theme. Not my layout. Please can someone offer me any advice? I basically need a replica of my website to be put onto the subdomain. I have done all of the steps above. I’m confused….it just looks like a new installation. :-( I thank you all in advance and Happy New Year! :-)

    # January 1, 2013 at 3:54 pm

    I may be wrong, but the way I handle WordPress local, staging and live is adding to each placement’s individual wp-config.php;

    define(‘WP_HOME’,’http://domain.whatever’);
    define(‘WP_SITEURL’,’http://domain.whatever’);

    Works for me, then you don’t have to mess about with the MySQL each time and can have a consistent SQL between all of them.

    Note sure if anyone can point to a potential problem with this method though?

    # January 1, 2013 at 5:10 pm

    Did you export your database?

    # January 1, 2013 at 5:55 pm

    @Chrisburton No I just host the DB in a live location from the beginning, so sit it on one of our VPS servers or wherever it would be ending up.

    # January 1, 2013 at 5:58 pm

    @andy_unleash Ha. That question was towards the person above you (@loubou).

    # January 1, 2013 at 6:00 pm

    My bad! Just realised from August as well – nothing to see here folks, ignore me and move along!

    # January 3, 2013 at 8:06 pm

    Eek, I didn’t realise anyone had replied. :-( Just changed my settings. Hi yes @chrisburton I imported the database. Someone told me that I should use the export/import tool in wordpress admin. I did that. Now all my products and everything are there but I had to change a lot of things. Why wasn’t it a carbon copy? Also my theme still isn’t the way I customised it to be. It’s the original file that I purchased. :-( Does anyone have any suggestions? I am going to buy a new theme and use a different shopping cart anyway. Problem is that i don’t want to do the all work on them on the test site/subdomain and then have all of these problems again when I try to put it back onto my main domain. That would seriously send me under so I rather find out what is wrong now instead. Then I will be good to go. :-) @andy_unleash I had left my comment a few ago so no worries! ;-)

Viewing 15 posts - 1 through 15 (of 28 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".