The process of moving your WordPress site from a subdirectory to the root directory might make you feel perplexed and bursting with energy, especially if you lack knowledge about the complexities of WordPress.
However, fret not as with proper planning and the right steps, you can successfully accomplish this task. Let’s guide you through this process step by step.
Understanding the basics
Before we start, let’s comprehend what a subdirectory is and how it differs from the root directory.
A subdirectory refers to a folder within your website’s primary directory that is usually employed for content organization or testing new features. For instance, if your website’s primary URL is www.example.com, a subdirectory URL might look like this: www.example.com/subdirectoryname.
On the flip side, the root directory refers to the primary folder possessing all your website’s files, such as the index.html/ php, robots.txt, and other files. Visitors accessing your website’s URL are directed to the root directory.
Now, let’s move ahead with the process of moving your WordPress site from a subdirectory to the root directory:
1. Backup your site
Firstly, take a backup of the entire site content to provide a safety net in case anything goes wrong during the process. You can utilize any backup plugin like UpdraftPlus, Duplicator, or WP Staging.
2. Update site URLs
The next crucial step is to update your site URLs. You’ll require changing your site’s database to perform this task, and there are multiple ways to do so.
One way is to modify the database directly via phpMyAdmin. Log in to phpMyAdmin from your hosting site, proceed to the wp_options table, and update the site URL and home URL under the option_value field.
Alternatively, you can use the Velvet Blues Update URLs plugin that automatically updates the URLs on your website. Here’s how you can utilize the Velvet Blues Update URLs plugin:
– Install and activate the plugin via the WordPress dashboard.
– Navigate to the plugin under the Settings section on your dashboard, and select ‘Update URLs’.
– Fill in the mandatory fields, including the old and new URLs.
– Click on the ‘Update URLs Now’ button.
Once you run the Velvet Blues Update URLs plugin, you’ll witness the URLs in your database updated from the subdirectory to the root.
3. Move WordPress files from subdirectory to the root directory
The penultimate step is to move your WordPress files from the subdirectory to the root directory. There are two ways to accomplish this.
a) The first method entails utilizing your hosting file manager or FTP client:
– Log in to your website’s file manager or FTP client.
– Navigate to the directory containing your WordPress site files, which could be the public_html, www, or htdocs directory.
– Choose all the WordPress files and folders located in the subdirectory and move them to the root directory.
– In case of replacing file messages, click ‘yes’ to overwrite files.
b) The second method entails using a plugin:
You can utilize plugins to move your WordPress site files from the subdirectory to the root. One of the options is the “All-in-One WP Migration” plugin.
– Install and activate the All-in-One WP Migration plugin via your WordPress dashboard.
– Utilize the plugin to export the WordPress site files from the subdirectory by going to Export>Export to>File.
– Download the export file.
– Extract the export file, and you’ll discover a file named “all-in-one-wp-migration-file-extension.sql.” Open this file and replace the old subdirectory URL with the new root URL.
– Once the database has the new root URL, save the file and import it into the new WordPress site located in the root directory.
– Install and activate the All-in-One WP Migration plugin once again, and import the downloaded archive by navigating to All-in-One WP Migration > Import > Import From > File.
By following these simple steps, you can successfully move your WordPress site from a subdirectory to the root directory.