Procédure
To move a WordPress site to a new domain name, you copy its files and database to the hosting of the new domain, adjust the wp-config.php file, then replace the old address with the new one in the WordPress settings. If your site is hosted on LWS Panel, WP Manager does all of this for you, without FTP or phpMyAdmin.
The manual method below is for other cases: a site hosted somewhere other than LWS, a new domain on another type of hosting, or a site that WP Manager does not support. The screen examples are those of LWS Panel.
WordPress stores the site address in its database. If you copy the site without changing it, it will continue sending visitors to the old address. The links you wrote in your posts and pages also keep the old domain: once the old site is deleted, they lead to 404 errors.
Moving the site changes the database, and an SQL query that has been executed cannot be undone. Before starting, keep a full copy of the site on your computer, in two parts:
These two copies are also used for the next steps: they are the ones you upload to the new hosting. Keep them unchanged until the new site works.
Your FTP credentials are in the LWS Panel of the new hosting, section Files > FTP Account(s), block FTP user list. The password is not shown there: if it is lost, click Change on the account line. Connecting with FileZilla is explained in How do I publish a site by FTP with FileZilla, Cyberduck or WinSCP?.
Upload all the backed-up files into the new domain’s folder, inside /htdocs:
/htdocs/blog.new-domain.fr/;/htdocs/new-domain.fr/), otherwise /htdocs directly.The LWS Panel file manager (section Files) lets you view these folders before uploading.
In the LWS Panel, section Databases & PHP, open MySql & Phpmyadmin and click Click here to create a MySql database. The database name, user, and password are generated by LWS: the password is sent to you by email and is no longer displayed afterward in the panel. See How do I create a Mysql database?.
On the line for the new database, click the ⋮ menu then PhpMyAdmin. phpMyAdmin opens in a new tab: the connection is not automatic, enter the database user (column User) and its password. Then import the exported file from the old database, as explained in How to import a database on LWS shared hosting with phpMyAdmin. For a large file, follow How do I import a large database on LWS Panel?.
The wp-config.php file, in the root of the copied site, contains the database connection settings. First make a copy of it (for example wp-config.php.before): if the site no longer displays, restore this copy. Then modify the following four lines with the values from the MySql & Phpmyadmin table:
define( 'DB_NAME', 'database_name' );
define( 'DB_USER', 'database_user' );
define( 'DB_PASSWORD', 'database_password' );
define( 'DB_HOST', 'mysql_server_ip_address' );| wp-config.php line | Where to read the value in the LWS Panel |
|---|---|
DB_NAME | Database column |
DB_USER | User column |
DB_PASSWORD | The password received by email when the database was created (lost: ⋮ menu > Change password) |
DB_HOST | Server IP column: an IP address, not “localhost” |
Also note the value of the line starting with $table_prefix (default 'wp_'): this is the beginning of your site’s table names, useful in the next step.
The changes below are those documented by WordPress in its official guide, section “Changing The Site URL” (Moving WordPress, on developer.wordpress.org). Make them in the new site’s database, after importing, and keep your backup close at hand.
In phpMyAdmin, click the database name in the left column, then the wp_options table (replace wp_ with your prefix if it is different). On the row where the option_name column is siteurl, edit the option_value column: enter the new full address, with https:// and no trailing slash, for example https://new-domain.fr. Confirm with Go. Do the same for the home row.
Your content may contain links and images with the old address. The query below is a template to adapt: replace the two addresses with your own, written exactly as on the site (with https:// or http://, with or without www), and replace wp_posts with the table name using your prefix. In phpMyAdmin, open the database’s SQL tab, paste the adapted query, then click Go.
UPDATE wp_posts SET post_content = REPLACE(post_content, 'https://www.old-domain.fr', 'https://www.new-domain.fr');Open the new address in your browser and browse a few pages: the text, images, and menus display, and the address at the top of the browser remains the new one. Then log in to the administration area at https://new-domain.fr/wp-admin: in Settings > General, the two address fields (WordPress address and site address) must show the new address.
To send visitors from the old domain to the new one, set up a redirect: Redirect a domain name to another web address.
Compare the four lines in wp-config.php with the database line in MySql & Phpmyadmin: database name, user, and server IP address. If you are unsure about the password, change it using the ⋮ menu > Change password, then enter it again in wp-config.php.
The siteurl and home lines in the options table still contain the old address. Check them in phpMyAdmin, in the new site’s database, and also verify that wp-config.php points to this new database and not the old one.
Yes. On LWS Panel hosting, WP Manager moves the site without FTP or queries (see the boxed note at the top of this help article). From another host, a migration plugin performs the transfer: see How to migrate a WordPress site with the All-in-One WP Migration plugin.
Ask the LWS team and the community. Answers are published after moderation.