WordPress how to move installation, change directory and URL
In order to move your WordPress installation to another directory, you need to execute a few steps.
1 – Changing URL with folder eventually changed accordingly
On your admin page, go to Settings.
There, change the WordPress Address (URL) and Site Address (URL), to match with the target folder – in below example, installation is moved from root folder to a sub-folder named v2.
Then, using your file explorer for a local site (i.e. on XAMPP), or your FTP client (i.e. FileZilla) if the site is online, move the whole WordPress installation, all WordPress files, to the destination folder.
2 – Change of directory only
Open the file index.php from WordPress folder, and find the following line :
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
Change it to match your new folder, as per below example :
- ./v2/wp-blog-header.php – if installation has been moved in a sub-folder
- ../[folder]/wp-blog-header.php – if installation has been moved in a parent folder
3 – Result
You can now try again to access your with the new URL you have entered in the first step !
It might not work directly on your browser when trying to access it, for cache reason. In case it doesn’t, try accessing the URL with another browser, it will correct itself after the cache will have expired.