How to change the working directory of WordPress
The good news is that you don`t have to reinstall WordPress.
If the database and URL remains the same, you will have to copy only the files and the database.
If you change the database name or the username, you must run again wp-config.php to set up the new
The first step is to create the new folder and then copy all the files from the older folder to the new one.
If you want to move the files to the root directory of the server, you will have to copy everything
including .htaccess file and index.php.
1. Then login to the administration panel of your blog and go to
Options/General panel. Change WordPress Address (the url of the new location that contains the WordPress files)
and Blog Address (this link should be the same with the WordPress Address).
After you press the Update button you can`t login again to the Administration Panel,
so make sure you do all the changes correctly.
2. The next step is to delete the files from wp-content/cache folder.
3. If you use Permalinks, the next step is to update the Permalink structure to the .htaccess file from
Administration Panel/ Options/ Permalinks. .htaccess should be in the same folder as index.php.
If you want to work everything just fine, don`t move the files before making the changes with the WordPress address.
If you did it, there is a solution. Using a symlink (kind of shortcut) and the following command
#ln -s /path/to/new /path/to/old
/path to old is the directory from where you moved the files and
/path/to/new is the folder where you copied the files.
After that, the last step is to test your website to see if everything is ok.
If you have problems with the images you will have to change the paths to the images from the SQL database.