/
/
Wordpress education
/
How to move Wordpress from a directory on a server

How to move Wordpress from a directory on a server

How to move Wordpress from a directory on a server

Transferring Wordpress from the working version to production is a simple task, however, it requires several operations and performing them in the correct order. Often the instructions given in hosting companies do not work or cause problems when swapping Wordpress addresses or replacing one version of Wordpress with another. See what Wordpress hosting is - marketing or actual benefits.

Another way could be to migrate Wordpress itself from a single instance on a working domain or directory to the target one, however, this is a so-called: on foot and too time-consuming task.

Below we will answer the questions we often face when running websites from draft to target.

From this article you will learn how to transfer:

  • website on WordPress between domains
  • WordPress to another hosting
  • domain with WordPress to another directory, subdirectory
  • WP from local server (localhost) to hosting,
  • Wordpress porting work rules what to keep in mind

Moving a Wordpress installation from a directory to the root domain

In this case, you need to copy two files located in your wordpress directory i.e. .htaccess and index.php. We do not move them but copy them. We perform the operation by connecting to the hosting via FTP account where we find our directory with Wordpress installation. We copy the two files to the main address, modifying their contents accordingly.

The next step is to change each of them, respectively:

Plik .htaccess

Change in htaccess file when moving wordpress from directory

In the original Wordpress file that is in the directory you will have a RewriteBase /directory entry

and at RewriteRule. directory/index.php

You should remove both directory names and leave the paths to the root of the server, i.e. the root of the domain.

File index.php

change in php index file when changing wordpress directory

In the original index.php file in the line require DIR . 'directory/wp-blog-header.php'; remove the directory and leave the notation referring to the root of the file on the server i.e.: domain root.

After the changes, upload the files to the new location ie: root of the main domain.

Wordpress address change when moving from directory to main address

That is, the actual change of installation address in WordPress.

In this step to run Wordpress on the main domain is to change the Wordpress address.

Important note - when moving Wordpress from a directory to a root domain, we only change the site address (URL) to the root address ie: domain address. Wordpress address remains unchanged.

Moving wordpress from a directory. Setting up url's.

It's still worth updating the new link structure in the WordPress admin panel just to be sure.

Just go from the Settings - Direct Links menu and select or change back to simple addresses and save.

See also useful resources about Wordpress :

How to move Wordpress from server to server ?

If you are changing server and need to move Wordpress from one hosting account to another you can manually perform all Wordpress transfer operations ie:

1) migrate the database from one account to another via WP plugin or directly from the hosting account from the admin panel

2) manually copying files through an FTP program,

3) change the configuration settings of the files in wp-config.php for the new database (i.e.: password, login and database name) and the new domain name (if you also change the domain address after migration)

For this you will need to set up a new FTP account on the new server and a new database. Then you need to migrate the database from the current server and import it on the new one via phpMyAdmin.

How to move Wordpress between servers more easily ?

Wordpress migration plugin - Duplicator

A plugin for moving Wordpress between domains and servers. Wordpress Duplicator.

A faster and more automated way is to use the Duplicator plugin, which installed on your current Wordpress installation will make a copy of Wordpress along with the database and settings. The next step is to set up the new database on the new server and upload via FTP the package that Duplicator will prepare along with the installation file to the new server at the destination where your new Wordpress will be.

After uploading the entire package downloaded by duplicator, just type po / installer.php in your browser and you will be connected to the automatic installation of your wordpress on the new server. In the next steps, the auto-installer will ask you for the database credentials you have set up on the new server, check the server settings and parameters and install the whole thing. Once the installation is done, the Wordpress installation file will be deleted and you will go to the Wordpress login panel on your new domain.

This way you can freely move websites between domains or servers saving time on manual database configuration, wp-config.php file and manual copying of Wordpress files. In addition, you don't have to log into phpMyAdmin and modify database records, which is often a problem for inexperienced administrators.