Do you have a website that you would like to move to a directory? Or do you have a site in a directory and would like to move it to the main folder of your domain?
Surely you have seen yourself reflected in the previous questions, because it happens more frequently than expected.
In this article we will see two ways in which you can carry out this process.
Using the tools of the Hosting account to change directory.
The idea of this method is first make a clone of your website, which will be an exact copy of your site in another location and after checking that everything works correctly, delete the original site.
From the Cpanel of your hosting account locate the section Websites Are Us applications and then the application called WPCenter, as shown in the following image:
Then a list will appear with the websites that have been installed in your hosting account using the Websites Are Us applications.
You will see that for each registration you have an option to configure, access that option, then at the bottom you will see that you have an option to clone the site.
By accessing the option cloning You will see a screen similar to the one shown below:
- You must enter the domain in which you want to have the cloned website, if you have more than one domain you must select the one you want.
- Write the path where the clone will be made, if you want to have the new site directly in the domain then just leave /
- Finally click on the button start cloning to start the process.
At the end, a screen will appear indicating that the process has finished and a link to access the new cloned website:
All right, you already have a clone of your site, now it only remains to delete the original website.
If the site has been installed with the Tools of your hosting account you can simply access the section>Websites Are Us applications and then in>Start.
Then you will see the installed applications, in our case we only have one, we use the button options to see the application detail:
The detail of the application will appear from where you can delete it, as shown in the following image:
Change WordPress directory manually
First we will move the files from the source directory to the new directory, you can use the application of the File Manager from your Cpanel, as shown in the following image:
Locate the folder where you have the website files, and then move them to their new location.
- Choose All the filesmake sure the hidden files like file .htaccess also be selected if you don’t see the file .htaccess, use the configuration option to see the hidden files.
- Use the option Move, a popup will open.
- Change the destination path, and finally use the button Move Filis.
Make sure the source folder is empty, then you can select and delete it.
We will make a modification to the file .htaccesswe use the File Manager to locate and edit the .htaccess and delete all references to the previous folder, as shown in the following image:
To do this We will use the Database Search and Replace Script in PHP script.
When entering the website we will have to register, since the script link will be sent to us by mail:
Once the file is downloaded, you can upload it to the server using the File Manager from your Cpanel from your hosting account.
- Upload file Search-Replace-DB-master.zip to the folder where you have the files for your website.
- Select the file to unzip it.
- Use the option extract to unzip the fileBy default, a folder with the same file name will be created.
Access the script folder from the browser based on the url of your domain, as shown in the following image:
Then the script interface will appear, as shown in the following image:
- In the field of Replace put the previous url (in our case the url with the folder), and in the field With put the new url, make sure that both urls do not have / at the end
- Fill the connection data to the databaseong>. These data can be obtained from the file wp-config.php from your website. Use the option Text ConectionYou should see a green message confirming that you have successfully connected.
- Optional: can you make one replacement test. This option simply performs a search and lists all matches but does not make a replacement yet.
- Once you’ve made sure there are urls to replace, you can make the replacement of the urls in the database.
- Finally you can delete script. This option does not always work so, make sure it’s actually removed since leaving this folder is a security problem.
Delete the script manually in case it has not been eliminated with the previous option.
You can verify it using the File manager from your Cpanel, as shown in the following image where we delete both the folder and the file .zip