Change links with SRDB
The SRDB (Search And Replace DB) tool makes it very easy to change your links when you change your domain name or structure.
To do this, it is mandatory to go to the PhpMyAdmin interface and manually change the links one by one, which can be very long if you have many articles and pages.
For the more experienced among you, the expert mode is the fastest solution.
In case you are not used to the terminal and the command lines, here are the steps to follow:
Download and install SRDB
Click on this link to download the latest version of SRDB.
Once downloaded, just unzip the file, and send the complete folder to the root of your site (next to the /wp-admin/, /wp-content/ and /wp-include/ folders), so that this tool can be accessed through a link like http://www.votredomaine.com/Search-Replace-DB-master/.
Enter URLs
First put the URLs in question. You can add several ways such as :
replace https://www.ancienne-url.fr with https://www.nouvelle-url.fr
replace http://www.ancienne-url.fr with http://www.nouvelle-url.fr
replace https://ancienne-url.fr with https://nouvelle-url.fr
replace http://ancienne-url.fr with http://nouvelle-url.fr
Then specify the database connection parameters. If you have lost them, they are still present in the wp-config.php file.
Click on Test connection.
The interface should display the message Success. You are connected.
You can choose the tables or let the system check all the tables.
Simulate the change
To make a simulation, click on the button Do a safe test run. The tool will search for the presence of old URLs and display the tables in which they are found. The changes will not be applied yet.
Implementing change
Click on the button Search and Replace.
The system asks you to confirm your action.
The same URLs detected earlier in the simulation are this time fully updated for the new URL.
Remove SRDB
Now that everything is changed, you can remove this tool by simply clicking on the Delete me at the bottom of the page.
The interface displays a message indicating that the module has been successfully deleted.
Purge the Varnish cache
You need to check that your theme or one of your extensions do not generate CSS or JS files containing urls. In this case, you just have to purge these files from the settings pages or from the tools of your theme or extensions.
And all that's left is to purge your Varnish cache from your WordPress administration.
Remember to empty your browser cache, by following this article.
Change links via the expert mode
You can replace the links when changing the domain name, or structure, directly from the command line.
WP-CLI, being accessible from your console, just type the following command:
Always try to do without the protocol and without the www :
Remember to empty your browser cache, by following this article.