Web-en

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.

Wordpress how to move installation and change directory : Default URL settings
Default URL 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.

Wordpress how to move installation and change directory : URL settings updated with new folder
URL settings updated with new folder

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.

Wordpress how to move installation and change directory : Moving installation files to new folder
Moving installation files to new 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' );

Wordpress how to move installation and change directory : Standard index.php settings
Standard index.php settings

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

 

Wordpress how to move installation and change directory : Index.php settings updated with new folder
Index.php settings updated with new folder

3 – Result

You can now try again to access your with the new URL you have entered in the first step !

Wordpress how to move installation and change directory : WordPress accessed from new URL
WordPress accessed from new URL

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.