Installing WordPress in a subdomain is a great way to create a staging environment for development. The subdomain (for example http://dev.askwpgirl.com) is a self-contained space to do development without interfering with the live site. When the development phase is complete, the question becomes “How do you move WordPress from the subdomain to the root?”
Note: If you installed WordPress in a subdirectory (e.g. http://mysite.com/subdirectory) and not in a subdomain (http://subdomain.mysite.com), then please see How to move WordPress from a subdirectory to the root.
You can “move” WordPress from the subdomain to the root domain using one of the following approaches:
- Back the site up using a backup or migration plugin (such as BackupBuddy, Duplicator, or All-in-One WP Migration). While leaving the subdomain of the site intact, you can restore the backup of the subdomain to the root directory. This is a nice option as it allows you to keep the WordPress install in the subdomain as a perpetual staging environment for testing WordPress updates or trying out new plugins or code.
- If you do not want to maintain two WordPress installs on your hosting account (which is twice the work as maintaining one site and necessary to prevent hacking), you can do one of the following:
- move the WordPress install to the root directory
- keep the WordPress install in the subdomain folder, but rewrite the URLs to display them from the root
- use one of the plugins mentioned above to “migrate” the dev site to the root directory then delete the subdomain.
Below are instructions for how to move or show the site from the root directory without using a migration plugin.
Before moving WordPress from the subdomain to the public_html (aka www or “root”) folder
Note: When I say “root” I mean the domain root NOT the hosting root folder. The domain root folder is typically called html, www, or public_html on most web hosts. Some WordPress installs are pretty gnarly with folders inside of folders inside of folders, and finding the folder that the host considers to be the primary domain root folder can take some digging.
1 – Be sure you have access to your web hosting control panel and File Manager within the control panel as well as access to phpMyAdmin should you need to revert the changes you make to the WordPress General Settings below.
2 – Make a back up of your database using UpdraftPlus or BackWPUp plugin. Download this file and keep it safe.
3 – Remove any old site files from the public_html directory — perhaps copy them to a folder called _backup – this includes an index.html file which will totally make this process not work. You MUST remove all those old site files and folders or move them into another directory, so they don’t interfere with WordPress. Having an index.html and index.php in the same folder causes confusion, and likely, the index.html will be used instead of WordPress’ index.php file. Do not move server related folders in the public_html directory such as cgi-bin. It’s okay for those to stay in place.
4 – Make sure you don’t have any other folders in the root directory that have the same name as any pages on your WordPress site, for example “blog” unless of course this is the name of your subdirectory install of WordPress in which case you cannot have a page of the same name because the browser will get confused and look for that page in that folder, then things are really confused.
5 – If you are using a caching plugin, delete all cached pages and de-activate caching.
Option 1: Move WordPress from subdomain folder to public_html directory
This is the most straight forward process to get WordPress out of the subdomain and into the root directory.
1 – Go to Settings > General and change the URL for both the WordPress Address and Site Address to use the main domain name. Be sure to remove the trailing / . Click Save Changes.
2 – Using FTP or the web host’s File Manager, you will need to MOVE all of the WordPress files from the subdomain’s folder up one level to the public_html aka domain root folder.
To do this with FTP, in the remote server area of the FTP application window, toggle open the subdirectory containing the WordPress installation you wish to move. Select all the files in this directory and drag them out of this directory and into the public_html folder or whatever directory this directory is within.
If you are using the File Manager on the web host’s control panel:
- Double click the subdirectory containing the WordPress files to expand it open.
- Click Select All to select all the files and folders.
- Click the Move File icon.
- In the Move dialog box, remove the subdirectory from the path field, so the path you are moving to is /public_html
- Click Move Files.
(Note: Some hosts might have a different name for this folder or you may have installed WordPress in a subdirectory inside another directory. Just remove the current subdirectory from the path along with the forward slash /, but don’t remove anything more than that.)
The files should now be moved to the public_html.
3 – Login to WordPress in the root directory which should be your domain name plus /wp-admin, e.g. http://mywebsite.com/wp-admin.
4 – Go to Settings > Permalinks and click Save Changes. This will rewrite the .htaccess file that controls the “pretty” URLs on the site. This likely isn’t going to be an issue when you are using a subdomain install, as the .htaccess contents should be correct.
5 – Install the Velvet Blues Update URLs plugin.
Under Tools > Update URLs, type the subdomain website address in the Old URL field and the main website address in the New URL field.
Be sure to not end the URLs with a forward slash /. If you do end it with a forward slash, end it with a forward slash for both URLs not just one. Consistency is important here.
Be sure to NOT not update all GUIDs. This will result in many theme settings to reset and posts to republish to the RSS feed.
6 – Click the Update URLs button. This should catch most of the URLs on the site. However, if it seems to miss several, you can try repeating this process without the http:// part of the URL, and see if it catches more.
7 – Check for other URLs not caught with the Velvet Blues plugin including:
- Appearance > Menus — check for any custom URLs to the old site URL in any custom menu items, such as the home page link.
- Appearance > Theme Options or your theme’s Theme Options page — check the URLs for any uploaded files such as the logo or favicon and remove the subdirectory from the URLs as needed.
- Sliders — If you use Revolution Slider or other slider plugin may not update the URLs to the slider images with the Velvet Blues plugin. Edit the slider and remove the subdirectory from any image URLs.
- Shortcodes and custom layouts — Some shortcodes for button links or custom theme layouts may contain URLs to the subdirectory which you may need to manually change. If you can find a pattern to these, you can try to run the Velvet Blues plugin again using the URL pattern you find.
8 – Test the site and be sure everything is appearing as expected. If anything is amiss, be sure to clear your browser cache completely or test in a browser you don’t usually use.
9 – Reset the caching and update the .htaccess file per the caching plugin instructions as needed.
Please comment below if you have any issues, as I can write more instructions for troubleshooting as needed. The main issue with this technique is that it’s possible for people to move the WordPress files BEFORE making the URL edits in the General Settings, and that will make the site inaccessible. However, this is quickly remedied by going into phpMyAdmin and accessing the wp_options table and changing the site and home URL as needed.
Option 2: Keep WordPress in the subdomain’s folder but show the URLs from the root
This option is slightly less intimidating because it doesn’t involve moving all the WordPress files. You only need to copy one file and move that to the public_html directory. This process will not allow you to access the WordPress installation via the subdomain any longer. It simply allows you to keep WordPress in the subdirectory (aka subfolder) on the hosting account created for the subdomain but essentially makes the subdomain not usable unless you recreate the subdomain and have it point to a different folder.
The only issue with the process below is if you created a not-so-user-friendly subfolder name for the installation, such as “dev” or “test” or “staging.” This would not be a professional folder name to use on a live site. Even though this process will allow you to show the URLs from the root of the domain, your uploaded images, PDFs, and other media files will reference the subdirectory (subfolder) name.
Changing the WordPress Subdomain/Subfolder Name
If you want to throw complete caution to the wind, you could go ahead and rename the subfolder, and I will tell you below EXACTLY at which point in the process to do so, so you don’t lock yourself out of the site. But, have no fear! If you do mess up the folder name or the URLs, you can always fix this in the database using phpMyAdmin. In fact, trying this process on non-critical websites can build confidence in future migrations. Breaking things is always a great way to learn! Just maybe not on a client’s site.
Keeping WordPress in the subdomain folder but showing URLs from the root
1 – In your web hosting control panel File Manager or FTP application, please take note of the folder name of the subdomain installation. This is typically the same name as the subdomain, e.g. dev, staging, blog, test, etc., but sometimes it is different, so make sure you know what it is before proceeding.
2 – Go to Settings > General. What you will see is something like this:
You need to change the URLs to this where the WordPress Address is the main domain URL with a forward slash followed by the folder name you made note of in step 1 above, and the Site Address is the main domain URL.
Now is the opportunity to CHANGE the folder name but don’t do it in the File Manager or FTP yet. If you want to use a different folder name, enter that in the WordPress Address field, e.g. http://mydomain.com/newfoldername, then we will rename the actual folder in step 4 below.
3 – Click Save Changes. You will be immediately kicked out of the site.
4 – If you changed the folder name in the WordPress Address field, go ahead now and change the folder name in your control panel’s File Manager or FTP application.
5 – While you are in the File Manager of FTP application, download the index.php file in the subdomain’s folder.
6 – In a text or HTML editor, open the index.php
file that you just downloaded and change the location of the wp-blog-header.php
to tell WordPress where it can find the WordPress application files in the subdirectory:
Example: if your WordPress installation folder is ‘subdomain’, you would change:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to
require( dirname( __FILE__ ) . '/subdomain/wp-blog-header.php' );
Important: Be sure you type this correctly! A missing / or too many slashes or missing period or apostrophe can make this not work. Believe me, I’ve seen people be totally freaked out things didn’t work and it was because they typed this line wrong.
Do NOT edit this file in Word or any text editor that uses Rich Text as it will turn the straight quotes curly and will break your site. If you don’t have a code editor application, then upload the file to your hosting account (see Step 7 below) and then edit it using the Editor feature in the File Manager instead.
7 – Upload this edited index.php file to the public_html folder on the hosting account. The file structure will look something like this:
8 – Login to WordPress in the root directory which should be your domain name plus /wp-admin, e.g. http://mywebsite.com/wp-admin.
9 – Go to Settings > Permalinks and click Save Changes. This will rewrite the .htaccess file that controls the “pretty” URLs on the site. This likely isn’t going to be an issue when you are using a subdomain install, as the .htaccess contents should be correct.
10 – Install the Velvet Blues Update URLs plugin.
Under Tools > Update URLs, update your URLs as follows:
In the New Site Address field enter the URL to the correct folder name for the WordPress install that is in your Settings > General for the WordPress URL.
Be sure to not end the URLs with a forward slash /. If you do end it with a forward slash, end it with a forward slash for both URLs not just one. Consistency is important here.
Be sure to NOT not update all GUIDs. This will result in many theme settings to reset and posts to republish to the RSS feed.
11 – Click the Update URLs button. This should catch most of the URLs on the site. However, if it seems to miss several, you can try repeating this process without the http:// part of the URL, and see if it catches more.
12 – Check for other URLs not caught with the Velvet Blues plugin including:
- Appearance > Menus — check for any custom URLs to the old site URL in any custom menu items, such as the home page link.
- Appearance > Theme Options or your theme’s Theme Options page — check the URLs for any uploaded files such as the logo or favicon.
- Sliders — If you use Revolution Slider or other slider plugin may not update the URLs to the slider images with the Velvet Blues plugin.
- Shortcodes and custom layouts — Some shortcodes for button links or custom theme layouts may contain URLs to the subdirectory which you may need to manually change. If you can find a pattern to these, you can try to run the Velvet Blues plugin again using the URL pattern you find.
- Any manual links to internal pages will need to be edited to point to the domain without the subfolder in the URL.
13 – Test the site and be sure everything is appearing as expected. If anything is amiss, be sure to clear your browser cache completely or test in a browser you don’t usually use.
14 – Reset the caching and update the .htaccess file per the caching plugin instructions as needed.
This process is obviously more steps, and you need to be careful with each step to make sure you type the correct URL and folder names. Otherwise, it’s actually pretty simple. I think the most difficult part here is that you essentially going from a subdomain install to a subdirectory install then taking it one step further to show the URLs from the root domain and in this whole process you may have gone wild and decided to change the folder name while you were at it!
Fixing WordPress URLs in phpMyAdmin
For both of these processes, the main mistake that might be made is to the URL fields. A simple typo can really cause problems. To fix this, log in to your web hosting control panel and go to phpMyAdmin. If you are prompted for a username or password for the database, you can find both of these in the wp-config.php file in your WordPress install. (Tip: In the File Manager, you can view the wp-config.php file and copy the username and password to a text file on your computer for easy reference.)
1 – Once in phpMyAdmin, click on the wp_options table.
2 – Click the Browse tab at the top of the phpMyAdmin to see the contents of the wp_options table.
3 – Look for the two options names: siteurl and home.
4 – Check to make sure these are correct. If you did the process outlined in Option 1 above, both of these should be simply the website URL (e.g. http://mysite.com). If you did the process outlined in Option 2 above, the siteurl should contain the subfolder name. Check the File Manager or FTP application to make sure you have it correctly entered. The home URL should be the main URL for the site.
5 – If you need to edit these, click the pencil icon, make the changes, then click the Go button to save the changes.
Let me know if you get stuck! Write in the comments or contact me directly. I can often provide quick advice. If things are not easy to address via email, I am available for hire. It typically takes me 5-15 minutes to login and figure things out.
I would love if you could Tweet about this if it helped you!
Please I followed this process of moving my website from subdomain to root and everything now works fine but when I try to delete or rename the subdomain folder my website loads an error
what can I do
Hi Ayodeji,
Do you happen to use Wordfence plugin? That can be the cause of the issue as it adds a line to the user.ini file pointing to the old folder.
Angela
Thanks Angela—very useful and clear guide!
Great job with this article! Thank you so much! 🙂
Hi Angela,
Thank you for all the information and all has seemed to work other than one issue.
old site name: https://ajkgrips.com.au/wp/
updated site name: https://ajkgrips.com.au/
The issue is this.
When I click on ‘home’ in the menu I am redirected to https://ajkgrips.com.au/wp/
which is the old subdomain address and a blank page with an ‘Index of /wp’ heading
I can’t work out how to remove the /wp/ from the URL within wordpress.
This is my first WP website, so a bit inexperienced.
Many thanks
John
Hi John,
This is an easy fix: Go to Appearance > Menus and edit your menu item for home to be the URL for your site rather than with /wp in it.
Angela
Option One works like a gem for me. Thanks, my Sister in WP
I’m so glad to hear that!
Hi Angela. Many thanks for the brilliant, clear instructions. I used Option 1 and it worked like a charm! Thanks! My only concern is that when a Google search for the site is performed, clicking on the hits results in a 404 error. I’ve pinged Google with the sitemap.xml, so the robots should re-crawl at some point, but how do I correct this in the short term? Is it worth setting up 301 redirects? I’m also haveing probs with Site Verififcation (google says the html file I uploaded has the wrong content!) so I don’t have access to the Search Console.
Hi Tony,
Sorry for the late response. Yes, a global 301 wild card redirect would fix the issues you are speaking about.
You can validate Google Search Console using Yoast plugin and HTML tag per these instructions:
https://askwpgirl.com/submitting-wordpress-site-google-search-console/
I was really starting to think I’d screwed up the transfer from sub-domain to root. Then I came across this page and this step in particular :
9 – Go to Settings > Permalinks and click Save Changes. This will rewrite the .htaccess file that controls the “pretty” URLs on the site. This likely isn’t going to be an issue when you are using a subdomain install, as the .htaccess contents should be correct.
All the URLs now work as expected. Amazing.
Thanks
Allan, I’m so glad that worked for you!
[* Shield plugin marked this comment as “0”. Reason: Human SPAM filter found “,on” in “comment_content” *]
Hi Angela
Thank you very much for your article, it is very helpful !!
I have developer sub-domain site called new.loveantique.net (wordpress) that I want to replace the current site http://www.loveantique.net (drupal) with. The developer site has all the same products, same contents but the structure has changed.
I have created duplicated pages but permalink will be different
existing one”s permalink is in Japanese so is very long for silver tong product https://www.loveantique.net/content/%E3%82%B1%E3%83%BC%E3%82%AD%E3%83%88%E3%83%B3%E3%82%B0%E3%80%80%E9%80%8F%E3%81%8B%E3%81%97%E6%A8%A1%E6%A7%98
developing website’s silver tong product
http://www.new.loveantique.net/shop/silver-plated/cake-tong
When all the developing site is ready, it will move from subdomain to root directly. The Durupal folders in the root directly will be move to “backup” subdirectory. (just to keep for while until new website is settled )
but how can I set redirect? Google will pick up my old URL from Pinterest or search , I would go all my old URL to the correct URL of same product in the new website.
My plan is to keep all copy of product page URL before moving existing website folders to subdomain “backup”, then after the new website is moved to root directly, I will individually redirect old url to new url ,one by one. ( I have about over 200 products and it will be very hard work though) Is correct? and only way? Do you recommend any wordpress plugin to help this?
Then, what shall I do with an old folder in “backup” subdirectory? I heard that SEO purpose they don’t recommend to have duplicated contents under the same domain name. my old folder has almost all same content to the newly developed website.
Hi Karoru,
You do not need to keep the old site to do the redirects. What I would do right now is download Screaming Frog which is a free application that will allow you to scan the site for all the current site URLs. You can export these URLs to a spreadsheet.
You will want to put the old URLs in one column, and the new URLs in the column next to it.
For URLs that are all going to be the same on the new site but with new directories, you can use Regular Expressions to capture dozens of URLs with one redirect. You can read about Regular Expressions here:
https://howarddc.com/understanding-redirection-regular-expressions/
You can use these Regular Expressions in the Redirection plugin. You can also upload a spreadsheet of redirects to the Redirection plugin https://wordpress.org/plugins/redirection/.
I recommend testing your redirections first if you use the wildcard variety. To test, set the redirection to be 302 instead of 301. 301 is permanent and is cached by browsers and will cause problems for you if you did your redirection wrong. 302 is temporary and allows you to easily test before changing it to 301. 301 is important for SEO, so don’t leave them at 302 once you know they work.
Good luck!
Angela
[* Shield plugin marked this comment as “0”. Reason: Human SPAM filter found “_htm” in “comment_content” *]
First off, thank you so much for this tutorial and your other tutorial for moving WP from subdirectory to the root directory. In my case, I had both a subdomain and subdirectory, I wanted to keep the subdirectory so I followed the steps in your other tutorial and that worked great, the WP installation was stored inside a subdirectory called staging but the URL didn’t show that.
Now, I tried to follow the steps in this tutorial to move WP from subdomain to main domain but I kept running into ‘500 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.” when attempting to access the dashboard after moving the files. Then I thought maybe I did a mistake in the dashboard so I went to wp-config.php and added the following lines:
define(‘WP_HOME’, ‘http://site.com/staging’);
define(‘WP_SITEURL’, ‘http://site.com’);
that got rid of the 500 error but resulted instead in
“This page isn’t working
site.com is currently unable to handle this request.
HTTP ERROR 500”
Your help is highly appreciated. My setup was as follows
public_html/staging/staging –> for this setup, I followed the steps in the other tutorial to get rid of staging in the url, to access the site, i used to write staging.site-me.com and for dashboard it was staging.site-me.com/staging/wp-admin
now, i want get rid of old site found on site-me.com so i placed all old files in a backup folder then moved all files form public_html/staging/staging to public_html/staging and got rid of the second staging folder, i know u say to get rid of all subdirectories but i wanted to maintain the /staging subdirectory given that i got it to work in the previous tutorial and given that it is good for security.
Hi,
This all sounds a bit complicated. Here is what I recommend to keep things simple:
1 – Have a SUBDOMAIN for staging area/development sandbox. Keep this perpetually active for testing purposes. You will never go live from this site but just use it for testing code changes and plugin updates, etc. This subdomain will be in a folder in your public_html directory. URL will be something like staging.mydomain.com.
2 – Have your main site in the public_html directory or another subfolder of the public_html directory if you prefer to keep your public_html directory clean. I usually name this folder something not embarrassing since images and documents will be viewable from that URL, so I often use an acronym for the client’s site.
It sounds like you got things a bit tangled up. I would check the following:
1 – Remove the define lines in the config file.
2 – Login to phpMyAdmin and make sure you have your URLs correct in the wp_options table for the home and site url.
3 – Check the index.php file to make sure there isn’t a typo there.
4 – Be sure you have no cached files being accessed. These are defined in the wp-config file as well and are often a culprit.
If you need help, email me via my contact form. I can usually untangle things in a few minutes and can take payment via Paypal.
Hi there!
I’ve never done this on my own and I’m having a bit of trouble. I’m trying to do option 1.
I have developer sub-domain site called dev.charlottedancegypsies.org that I want to replace the current site http://www.charlottedancegypsies.org with. I want to keep the original domain name (charlottedancegypsies.org) but have the site become what the new dev site is.
I currently have both folders (charlottedancegypsies) and (dev) folders in my main public/html section.
When I went into the dev site general setting and switched it to charlottedancegypsies.org, now when I type dev.charlottedancegypsies, the original site I want to replace comes up. I cannot access the dev site. Is that correct? Do I need to access the general settings of the original website and change the wordpress address and site address to dev.charlottedancegypsies.org?
What have I missed?
Thanks!
Hi Melody,
I think perhaps you missed a step and didn’t edit the index.php file in the public_html folder to access the new site in the dev folder. See step 6 on https://askwpgirl.com/move-wordpress-subdomain-root/ under “Keeping WordPress in the subdomain folder but showing URLs from the root.”
Let me know if you need help. You can reach me via my contact form plugin.
Angela
Hi Angela!
I am so thankful I found your website/article. I do have a few other questions I was hoping you could help me with!
I created a subdomain so I could develop a new site without effecting the current live site, and when I did that, it somehow created a subdirectory as well so instead of being able to access it at dev.subdomain.com it is dev.subdomain.com/wordpress.
When we are ready to move to the live site, do I need to first, move the subdomain to the root and then the subdirectory to the root directory? Are there any extra steps I would need to take first since we have both a subdomain AND subdirectory?
Any help would be GREATLY appreciated!
Thank you,
Chelsea
When you create a subdomain, a folder is created in the public_html folder to house the subdomain, so that is normal. However, it sounds like when you ran the Installer app on the web hosting account, it put the site in a subfolder within in your subdomain.
When you are ready to move the site to the public_html directory, use Option 1 in my post: https://askwpgirl.com/move-wordpress-subdomain-root/ The process will be the same. You will change your General Settings, then move the files to the public_html directory and then login to the site from the root and run the Velvet Blue Update URLs plugin. The difference with this step is that you will search for http://dev.domain.com/wordpress and replace with http://domain.com
Does that make sense?
[* Shield plugin marked this comment as “0”. Reason: Human SPAM filter found “_htm” in “comment_content” *]
Actually, I am thinking I did something else wrong as well because the subdomain folder is not in the public_html folder it is outside on the same level as the public_html folder.
So I have in my file manager:
+home/domain
+ dev.domain.com
+wordpress (where my new site is located)
+public_html
Will I still be able to follow the steps in Option 1? First change the settings in WordPress and then move all the files directly into the path /public_html? Even though it is not just one level up?
Thank you for your help!
Hi Chelsea,
I would use “Option 1: Move WordPress from subdomain folder to public_html directory” on https://askwpgirl.com/move-wordpress-subdomain-root/ and move the files to the public_html folder.
Let me know how that works out!
Angela
[* Shield plugin marked this comment as “0”. Reason: Human SPAM filter found “_htm” in “comment_content” *]
Ciao Angela,
I’m newly on this.
I created a subdomain in order to create a new web to replace with the old one.
Now I’m going to move my subdomain to root.
I have a folder “cgi-bin” in the public_html (root).
The question, I have to move it with the other files of the old web?
Other thing.
Now I have the WordPress for the old web and the new one for DEV.
you wrote: 1 – Go to Settings > General and change the URL… I have to do it in the dev WordPress?
Thanks for your tutorial
Hi Calessio,
You do not have to move cgi-bin. You change the URLs while the site is still in Dev before moving it. Because after you move it, you won’t be able to access the site if you didn’t change these first. However, if you do make a mistake, you can login to the database via phpMyAdmin on the web hosting account and change the URLs to the correct URLs in the wp_options table.
Angela
I attempting option 1 right now and i moved my folder to the public_html and now when i access wp_admin all information from temp site is lost and its like a blank new site. Is there any way to recover this ?
Hi John,
Your site is not lost, and none of your data has been lost. So don’t panic. This results from a typo or not moving your files correctly or the domain not being pointed correctly.
When I go to your website URL, it looks like your domain is not pointing to a web hosting account. Let me know what domain name you are trying to move. If it’s the johnmalecki.com domain, then you need to point that domain to the host where you have your WordPress files you are working with. It looks like the domain is pointed to Blue Host. There is also no www record set up for your site on your DNS record, and it has recursive queries on the DNS record.
So, check your domain set up and which host you are actually using for your domain and make sure you have the domain correctly added to and pointed to your hosting account.
Angela
Hi, Angela! Tremendous resource here! I’m in the process of manually moving a WP site from a subdomain to a root domain for the first time.
So, quick question (showing my ignorance here): Do I need to install WP on the primary domain before moving the subdomain files, or does moving the file essentially ‘install’ WP on the root?
Thanks in advance!
Very good question, Tony. No, you do not need to install WordPress in the primary domain. Moving the files does essentially “install” WP in the primary domain. The issues that can arise are related to the web host and how they perceive this install. Sometimes the host is trying to micromanage the installation, such as on GoDaddy and Network Solutions. Let me know how the process goes for you.
Angela: thanks so much for taking the time to write such excellent instructions! I used them to help me manually move my school’s site from a subdomain to the root, and everything worked!
That’s fabulous, Greg!
If there are other subdomains on the main (I had just used a subdomain to set up my new wordpress site to get rid of the old joomla site on the main) will that affect anything if I try option 2?
Also, as a temporary fix, I had redirected the domains to my wordpress subdomain. Will I need to remove those first?
Thanks!
Good questions!
As long as the primary domain points to the public_html (aka root directory), then you could use option 2.
The other subdomains will continue to function in their respective directories.
You will need to remove the redirects to the subdomain as the redirects result in the domain pointing to the directory containing the subdomain instead of to the public_html folder.
Let me know how it goes!
Thank you! I just followed your instructions for a small website and it worked perfectly. My only issue was to do with Wordfence. I had moved the file with the main domain wordpress files, but also had it installed for the subdomain, so I received a 500 server error. I tracked it down through the log files on my host and copied the missing wordfence file back, and everything was fine. The whole process of moving did not take long, but the backup process, including installing the plugins for both sites, took a bit. Gotta have those backups!
Hi Jennifer, yes, having backups is a good idea. Wordfence is a bit of a bear. I’ve gotten a bit frustrated with it over the years and started using this plugin instead: https://wordpress.org/plugins/wp-simple-firewall/
Security and caching plugins can definitely muck up this process a bit, so I do recommend clearing the cache and de-activating. Wordfence is quite invasive and thus creates more site migration challenges. If people do want to migrate a site with an existing Wordfence install, I recommend going to the Wordfence options and checking the checkbox option to delete all Wordfence tables and data on de-activation. This will completely uninstall Wordfence when you de-activate it. Then, you can migrate the site, re-activate Wordfence and reset the settings. This would avoid the issues you had an ensure that it will work properly under the new URLs.
I tried option 2 but got an error and had to switch everything back in wp-options. It almost looks like you have combined the instructions for subdirectories with subdomains?
I built a fresh site in a subdomain and wanted to just redirect the main domain to it – like you can with .htaccess rewrite rules for subdirectories but that didn’t seem like it would work.
After debating far too long over the best approach I discovered a brilliant option I hadn’t even thought of before – I posted a support ticket to my host server and they just migrated the whole thing in minutes! I had no idea – duh. So this might be a suggestion for others. I’m at ICDSoft and they use cpanel – likely plenty of other hosts will provide this service too (it’s free)
Hi Eveline,
The instructions on this post are specifically for moving a SUBDOMAIN to the ROOT domain. And subdomains are typically installed in a subdirectory in the public_html folder. Hence why I mentioned subdirectory in this post.
You cannot redirect your main domain to your subdomain. Most hosts will not allow that.
So, yes, asking your host, if they are a good host, to migrate it for you is a great idea! Glad they were willing to do that. Sometimes they can redirect the primary domain to another folder on the site then rewrite the URLs on that install, and it works great!
Hey Angela,
A big thanks for pulling this together and keeping it simple.
I’ve been building an e-commerce site using the WooCommerce Storefront theme plus several WooCommerce extensions.
I used option 1 to move the new site to production and it worked exactly as you have it laid out above.
The only item that didn’t change the URL was a gallery plug-in which I had to manually update. Apart from that, it was easier than I expected.
Thanks again,
Dave
Hi Dave,
I’m so glad that worked out for you! Yes, sometimes plugins and themes will store absolute instead of relative URLs, and you have to manually edit them.
Be sure to check your logo and any other assets that might be in theme options or other settings, too!
Angela
Thanx for this comprehensive but still good-to-follow steps! Just migrated my new site from dev.url to url without a hassle in 30 minutes. Only thing is, I can;t get my contactform working. Any experience with this before?
Hi Matthijs,
Did you get your contact form working? I recommend Formidable Forms for free contact forms. https://wordpress.org/plugins/formidable/ It’s very reliable. I wonder if maybe your captcha was set up for the old site and needs to be updated to work with the new site?
Let me know how things are going.
Angela
Angela Bowman
Thanks for writing such clear instructions. I used your manual instructions rather than using Duplicator to move from my subdomain to the root directory. Your instructions were easy to follow and I had no problems.
I am glad the manual instructions worked. I usually do it manually. You should check your theme options to be sure your logo or any other background images set with the theme are using the correct URL. The Velvet Blue Update URLs plugin works pretty well, but it does miss some things in premium theme options and links in page layout builders. There are other plugins that are more effective at getting everything, but they can also mess things up.