I will explain the simple steps to perform the migration of a subfolder located on the address example.com/subfolder to the new location such as example.com
The first thing you have to make a backup of all files and database are part of you site, so that if any problems occur, we can return to the starting point.
Once done your backup, you access the administration of your WordPress and within the "
Settings" menu click on the "
General" option. In this screen we will have to make two changes:
WordPress address (URL): Here you indicate the new URL where files will be located as part of the application, in your case we change to
Site address (URL): In this box is noted as in the previous case, that is
Once made these changes, click on the "
Save Changes" at the bottom of that page.
If You had forgotten to make these changes before the migration, we can not access the administration to realize them. However it can be solved by accessing the database, using a tool in your hosting panel like
phpMyAdmin or similar one.
Once we are connected to the database, we have to go to the "wp_options" is the table that stores all options that can be configured from the administrator.
In this table you must find the "
siteurl" and "
home" options, and edit them to your new location.
After this step, the next you will move files in "your subfolder" to the root directory. This process is done by some FTP program such as Filezilla, CuteFTP or another FPT client that you can find in the network.
Once this process is completed, we will be able to re-access the administration of your blog through the url "http://www.example.com/wp-admin", but we will not be able to access the public part since we have changed the folder where it was installed WordPress.
To make it work you need to change the permalink links, an action that will change the file .htaccess which is part of the installation of the tool.
To make this change, you enter into the administration and go to the "
permanent links" that is in "
Settings" section. Once inside this section, click on the button "
Save Changes" to WordPress update your .htaccess file.
If you don't want to update the settings in wp-admin, you can directly copy codes into .htaccess file located in your root folder as follows
Once you have verified everything and they work correctly, it is recommended to delete the subfolder where you had before installing your blog, to avoid confusion in the future.
This same process can apply to migrate your WordPress installation from one directory to another completely different.