344: Moving a WordPress Installation to a Different Location
WordPress is typically installed into a folder that you designate on your web server. If you must move WordPress to a different folder then you will need to make some changes to your configuration files. An example of a move might be the change of the location of the WordPress installation into a folder called "blog". This would change the WordPress configuration and require that you move the files.
How to move WordPress into another folder
There are a few ways to move files around for your WordPress installation, but we will be describing how to move the files using the cPanel File Manager.
- log into your cPanel and open the File Manager in the Files section.
When you open up the file manager, look for the folder that currently has your WordPress files. Be aware that if you have installed WordPress in the document root, then the files and folders will be placed in the PUBLIC_HTML folder. The problem here is if you intend to move it, and you have multiple websites installed in your account, then you will need to be able to pick out the files and folders that belong only to WordPress. Below is a table with the default files and folders that appear when you install WordPress 3.6.1 (NOTE: WordPress 3.9x versions still retain the same folder structure and many of the same files. Please see WordPress files list for a complete list and description of the files within a base WordPress installation.
Folders Files wp-includes index.php wp-admin license.txt wp-content readme.html wp-activate.php wp-blog-header.php wp-comments-post.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
You will need to select all of the files and folders that are a part of your WordPress installation. If you installed WordPress in a separate folder, then you only need to select the folder to copy it. If you have installed WordPress in the PUBLIC_HTML folder, then you should use the list above to help you identify the default installation files. If you are using a different version of WordPress, then you can download the files from the WordPress.org home page. You will need to expand the zipped file in order to see the files and folders that make up WordPress.
If you have installed a plug-in or theme which alters the directory of WordPress, then you may need to work with the plugin/theme developers/support people. You can also simply select all of the files and folders in the PUBLIC_HTML folder and copy them into the new location if you have no other choice.
Click on Copy in the File Manager menu bar after you have selected the folder and/or files that you wish to copy.
A window will pop up instructing you to indicate where you want File Manager to copy your files. In the field provided, type in the new folder where you want your WordPress website moved to and click Copy File(s).
If you have not already created the folder where you wish to move your WordPress files, then you should create the folder first. In file manager, click on the icon labeled New Folder in the top left hand side of the menu bar. A window will pop up that is labeled "New Folder". Click on the New Folder Name field and then type in the name of your new folder. There will also be a field for the location of the folder. Make sure that it is in the location where you wish for the folder to be created. For example, if you wanted the "blog" folder to be inside the "public_html" folder, then the path should be "/public_html/". If you didn't want the folder to be created inside another folder, then this field should be blank.
If you have already created the folder, then insure that you are spelling the folder name correctly with the same letter case. For example, if the folder name was "blog" and it's in the PUBLIC_HTML folder, then the folder name you're typing should look like "/public_html/blog/". If it's spelled "BLOG", then the copy will not occur.
Don't be alarmed if nothing appears to happen for several minutes. This may take some time depending on the size of your WordPress site. If you want to see some type of status on files being transferred, then you should use a FTP client like Filezilla to transfer your files.
- If you selected your WordPress files individually, open the folder where your moved your WordPress website files to confirm that the files were copied. Compare the files and folders in the new folder with the files and folders in the old location. They should be the same. If not, then copy the missing files and folders starting from Step 1.
- Scroll down and search for the file called wp-config.php. Next, select the file and click on Code Edit at the top of the File Manager or right-click on the file and select Code Edit in the menu that appears.
In the code editor you will change two lines of code so that WordPress can be configured to the new location of the website. Look for the following code in the file:
/** MySQL hostname */
/** Database Charset to use in creating database tables. */
/** The Database Collate type. Don't change this if in doubt. */
After the code that you see above, add the following lines to the code. If they are there already, then change the location to match your new folder location.
Do not change the code other than to change the location. Specifically, you will be changing domain_name.com/newlocation with the location where you have moved your WordPress website files and folders.
- After the two lines of code have been modified, click on the Save Changes button at the top of the page to save your changes.
Check the new location in your web browser to confirm that it is working. Carefully review your changes if you have any problems seeing the WordPress site appear. Even small changes to the syntax would cause problems with its operation. Verify that the site is working and that all files and folders that were moved correctly are appearing correctly. If the files are working from the new location, then you can delete the files and folders of your original WordPress installation.
Hopefully, your move has occurred with no problems. There a few other things to keep in mind and check. If you are using permalinks, you will want to reset them. Permalinks are search engine friendly links that can be reset by simply setting them to DEFAULT, then re-assigning them to your previous custom setting. Finally, moving your WordPress link can also possibly disrupt your graphic links in your posts or pages. Luckily, we have a tutorial for this issue called Correcting Image Links after a WordPress Migration. Take care to review these issues and then your move should be complete!
Please note, if you installed WordPress through Softaculous, moving your WordPress installation as outlined above will NOT update the Softaculous installation information. You can change this information using the Edit Installation Details option in the Softaculous installation. You will want to do this if you intend to continue using the management options available with the Softaculous installer software.
‹Section 7: 345: How to change a theme via the database
›Section 9: 343: Wordpress - "Error Establishing a Database Connection"
Support Center Login
Social Media Login
2015-11-19 3:50 am
I have 2 question, I read the wordpress codex version of this (https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory) and they've
1) kept a copy of .htaccess and index.php in the root folder.2) Made the coding location change in the root folder index.php (from step 7)
I was wondering what's the difference between changing the address in the root index.php and in the copy wp-config.php?
Also, I have a .qidb, cgi-bin, and wc-logs folder in the root folder. I don't think theyre part of the wordpress files, so should I leave them in the root or move them to the new folder?
Thanks in advance!
2015-11-19 4:33 pm
Thanks for the questions. InMotion Hosting defines the default root folder as the PUBLIC_HTML folder. This is the location where website files are placed by default. WordPress uses the wp-config.php to determine where it's installation location is set. It does NOT use the index.php for this. Other websites typically use the INDEX.PHP (INDEX.HTM or INDEX.HTML) as the central page of the website. WordPress does not do this. They use a virtual page that is assembled on the fly depending on the settings you have created with your WordPress installation.
The WordPress files list is pretty old (considering we're on version 4.31), so I wouldn't wory about not having those other files for your WordPress site.
I hope this helps to answer your questions, please let us know if you require any further assistance.