In this guide, we will teach you how to move WordPress from one folder to another within the same web hosting.

Attention!
Before making any changes to the website, make sure you have current backups of both your WordPress installation and the database. This way, you can revert to the previous version of your work in case of any errors during the process.

To move WordPress to a different directory in the same web hosting, you first need to access your WordPress admin and within “Settings” select the “General” option.

Settings ->> General

 

On the next screen, change the root URL of your WordPress installation and enter the new path where you will move the website. Edit the addresses in the fields: ‘WordPress Address (URL)’ and ‘Site Address (URL)’, then click the ‘Save Changes’ button.

For example, if your WordPress URL was www.mydomain.com/tests and you want to move it to the root directory, just enter www.mydomain.com.

Attention! Check if your website has SSL to switch from http to https.

 

By making this change, your website will be hidden until you move all WordPress files from the old folder on your hosting.

Use FTP to transfer all WordPress files and directories to the new folder or root directory.

After moving everything, your site should display correctly. If you’ve added images or links, update them to the new URL — www.domain.com.

Check your WordPress Dashboard to ensure no links point to the old URL.

We suggest the “Better Search Replace” plugin to search and replace data in the database.

 

 

 

 

 

 

Once the plugin is installed and activated, go to ‘Tools’ -> ‘Better Search Replace’ and next, fill in the fields of the ‘Search/Replace’ form as we indicate below:

 

  • “Search for”: enter the old URL of your website (e.g., https://www.mydomain.com/tests). Note: you need to consider if your website has SSL or not to include https in the search.
  • “Replace with”: here you should write the new URL of your website (e.g., http://www.mydomain.com). You need to consider whether your website has indexed www or not.
  • “Select tables”: select the tables where you want to make the change. Usually, all tables should be selected.
  • “Case-Insensitive”: By default, searches are case-sensitive, so there’s no need to select this option.
  • “Replace GUIDs”:  leave this option unchecked
  • “Run as dry run”: If checked, no changes will be made to the database, allowing you to check the results beforehand. It is recommended to run the test first, and if everything is correct, you can proceed to uncheck the box and run the search and replace process again.

Finally, you need to refresh the permalink structure. Within your WordPress administration, go to “Settings” and select the “Permalinks” option.

On the next screen, you can choose from the suggested permalink formats or create your own by selecting “Custom Structure”. To save changes, click the “Save Changes” button.

Settings ->> Permalinks

Once all these changes have been made, your website should now be displayed without issues in the new folder or in the root directory of your hosting.

 

It is recommended to uninstall the ‘Better Search Replace’ plugin once you have completed the Search/Replace process.