Support » Fixing WordPress » Moving WordPress from subdomain to main domain

  • Greetings!

    I’ve read the WordPress Codex instructions regarding moving WordPress, but none of the information provided seems to apply to my exact situation and I have a couple of questions before I go and break things.

    1) I have a main domain and a subdomain. The main domain (www.thomasfielding.com) is a static old (!!) site that does NOT have WordPress installed.

    2) The subdomain (wp.thomasfielding.com) has WordPress 4.4.3 installed in /public_html/wordpress/. This is where I’ve done my development of the new site. Users who go to wp.thomasfielding.com DO NOT see a subfolder in the URL.

    3) The content for BOTH http://www.thomasfielding.com ( the “old” site) and the content for wp.thomasfielding.com reside on the same server, and they BOTH reside in this user’s /public_html/. Two ‘sites’, one server, one directory tree. Old site in /public_html/, new site in /public_html/wordpress/.

    4) I am using cPanel. I am allowed one mysql database, which is being used by the wp subdomain.

    I would like to transfer the WordPress site to the main domain and deactivate the subdomain. I want users to land on the main WordPress site’s homepage page when they go to http://www.thomasfielding.com WITHOUT the URL reading as http://www.thomasfielding.com/wordpress/.

    Is there a quick way to accomplish what I want to do, or do I need to back up the entire wp subdomain WordPress installation (which was going to be my first step anyway), and then treat the www main domain as a “fresh” install?

    Oh, one other thing. My host’s server has a strict timeout limit that makes the Duplicator plugin fail, so I have to manually download and upload all my site content via FTP. The client is a composer, sells his sheet music, and needs large, high-resolution images that cause a server timeout when trying to use Duplicator.

    I *can* do all this the long, hard way and have before (site backup, FTP content, install on a localhost server running XAMPP, upload the package, install WordPress on http://www.thomasfielding.com, run the Duplicator installer). I’m just looking for a way to minimize bandwidth usage during all this.

    Again, I’ve read the Codex instructions on moving WordPress and the processes described there don’t seem to address this specific situation. That, or I’m misreading something. In any case, I’m not quite certain exactly how to proceed after I back up the “new” site and I’m in need of some advice. It’s my understanding that there’s an “easy” way to do this if cPanel is installed (it is) but I can’t seem to find the page again that said that.
    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi

    First step : edit your site url and wp url in your wp-admin->Settings

    Second step : Export your SQL (backup first) , then find and replace urls so that the /wordpress/ is removed from any possible links / images etc. Delete your old SQL and Import your newly edited SQL.

    Final step:
    I usually use Filezilla and backup the public_html directory before attempting the move.

    You can then delete the main site contents and navigate to WordPress directory , select all and drag & drop those files into the public_html folder. So no downloads/uploads necessary.

    You can also do this with the CPanel file manager etc. using the ‘move’ option after selecting all files in the /wordpress/ folder.

    Hope this helps , all the best!

    Thanks a lot! That looks like a fast rundown of the process described in detail here:

    Change and Update WordPress URLS in Database When Site is Moved to new Host

    Am I correct, and the information provided there covers in detail your step 2? I’m kind of a database novice (not much experience with mysql), so I’m a little nervous about editing it directly.

    Hi

    I use notepad++ to find and replace

    I usually handle it by searching for all instances of mydomain.com/wordpress
    and I replace with
    mydomain.com

    I leave out the http://www. in my find/replace as some links may/may not have identical structure so find / replace the parts you know will be present in every instance to make the process even more hassle free.

    Then I save as a new file and proceed to deleting the old SQL and importing the new SQL via the PHPMyAdmin tool

    It’s up to you to choose a method you’re comfortable with. For me, this is by far the easiest way.

    All the best!

    Okay, I just tried this on my localhost. The approach of editing the database directly doesnt work in my case because the theme I’m using utilities the WP API to store theme options. Editing tue database directly had the end effect of removing all theme customizations I had done even though I was using a child theme.

    The relevant support topic is at

    https://wordpress.org/support/topic/theme-delicate-theme-options-lost-when-moving-to-new-domain?replies=19

    Lesson: never ever directly edit the database. The strings are stored in a “coded” (serialized) format and editing them directly will break things.

    I’ll just do it the long, safe way. Thanks for your help, though- learning what not to do is just as important as learning what TO do, and this will help me avoid this trap in the future! 😀

    Hi

    You should have an export settings option on themes that work this way.

    You question contained no reference to the theme you are using / request for advice when dealing with themes such as these.

    Be precise the next time you need advice to avoid this ‘trap’ in the future 🙂

    Oh boy. All of this sounds like another language to me. Can someone make this a little easier to understand? I was told that I need to move the contents of public_html/site to public_html. jennatalleda.com. I use hostgator.

    Before you move the subdomain to the root:

    1) In your dashboard go to Settings > General and change the URL for both the WordPress Address and Site Address to use the main domain name.

    2) In file Manager or FTP: Make sure you move all your old site files into a folder for example called “old” otherwise you will not see the new moved site.

    3) Then use a couple of plugins to move your site and change all the URLS.

    I use the plugin “Duplicator” – https://wordpress.org/plugins/duplicator/ to copy the site and move it. (you can also do this step manually in your File Manager or FTP)

    4) Once you have moved your files to the root go to the dashboard of the new site and Go to Settings > Permalinks and click Save Changes.

    5) I also use the plugin https://wordpress.org/plugins/velvet-blues-update-urls/ to change all the URL’s on the site once moved.

    Here are some tuts for more detailed info:
    https://www.wpkube.com/move-backup-website-wordpress-duplicator-plugin/
    http://askwpgirl.com/move-wordpress-subdomain-root/

    • This reply was modified 2 years, 10 months ago by  rudanja.

    This thread helped me as well but I do have some questions. Im very new to this so please forgive me if Ive missed something obvious.

    I have worked on a new design on my sub domain and started from scratch without importing my old site to the sub domain. So now I have a new design, with a new theme and new url structure. When setting the new design live I understand migration/ moving the site from subs domain to main domain can be easily solved with a plugin like for example WP migrate DB Pro.

    Does this mean that when the design from sub domain goes live on the main domain, all content (media files posts etc) that have been published on the live site will be erased/ gone?

    Would it have been easier to backup the old site and import it to subdomain and then develop it from there?

    Okay so I had the same issue, having created a website (using WordPress) on a subdomain, but then wanting it to be its own domain. Let’s say it was XYZ.ABC.com. I wanted XYZ.com to be on its own and no longer a subdomain of ABC.com.

    For the record I have a Cpanel hosting account on Godaddy.com. ABC.com is capable of hosting several sites, hence I used it to create the XYZ.com as a subdomain.

    And I’m kind of an idiot when it comes to DNS stuff and I was really screwing things up.

    This is ultimately what worked for me… I cloned the WordPress site I had created on XYZ.ABC.com (using the Installatron Application tool) onto a domain that had nothing. We’ll call this other domain that had nothing on it RST.com. Once the site was cloned onto RST.com, I then deleted the files on the original subdomain of XYZ.ABC.com (by uninstalling the WordPress application on it). Gulp. It no longer existed.

    So, once XYZ.ABC.com was totally gone, I then cloned the site again (from RST.com) onto the domain I really wanted to not be a sub-domain, XYZ.com. Essentially, I cloned the clone.

    And the angels sang. Sure, it was a little convoluted, and I had to tweak a few things in Installatron, like removing the words “clone” and “clone clone” from those sites but it worked and that’s all that matters.

    I hope that all makes sense.

    When you say you have three sites you must mean you have three subdomain sites? Or one main domain and two subdomains? In each subdomain site directory should be a wp-config file. A wp-config file can only refer to one database. If the wp-config is in the root of your file manager it means it belongs to your main domain site.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Moving WordPress from subdomain to main domain’ is closed to new replies.