Migrating a website to a new domain is a process that can lead to various technical issues. One of the most annoying problems is WordPress redirecting to the old domain after migration. This is not an unusual phenomenon, and its solution may be simpler than it might seem at first glance.
In this article, we will discuss various methods to fix this problem, which include: changing WordPress settings manually, using special plugins, and manipulating WordPress files manually. We will try to explain all the methods as simply and clearly as possible, so that they can be used by anyone, regardless of the level of technical advancement.
I. Changing WordPress settings
Let's start with the simplest solution - changing the settings in the WordPress platform itself.
- Log in to the WordPress administration panel.
- Go to the “Settings” section and select “General”.
- In the “WordPress Address (URL)” and “Site Address (URL)” sections, change the address to the new URL.
- Click “Save Changes”.
Usually, this simple change should fix the problem. However, if the redirect still occurs, check the next methods.
II. Using the “Velvet Blues Update URLs” plugin
There are many plugins available in the WordPress repository that can help you solve the redirect problem. One of the most effective is "Velvet Blues Update URLs".
- Log in to the WordPress administration panel.
- Go to “Plugins” > “Add New”.
- Search for “Velvet Blues Update URLs”, install and activate this plugin.
- Go to “Tools” > “Update URLs”.
- Enter the old URL in the "Old URL" field and the new URL in the "New URL" field.
- Select the options you want to update.
- Click "Update URLs NOW".
After following these steps, all links on your website should be up to date and the redirect problem should disappear.
III. Using the “Better Search Replace” plugin
Another helpful tool is the “Better Search Replace” plugin. It allows you to quickly and safely search and replace any string in the WordPress database.
- Log in to the WordPress administration panel.
- Go to “Plugins” > “Add New”.
- Search for “Better Search Replace”, install and activate this plugin.
- Go to “Tools” > “Better Search Replace”.
- Enter the old URL in the "Search for" field and the new URL in the "Replace with" field.
- Select the tables you want to search, or select “Select all tables” if you want to search the entire database.
- Click "Run Search/Replace".
IV. Manually editing the wp-config.php file
If the above methods do not bring the desired effect, you can try to manually edit the WordPress configuration file. However, this is a method that requires some technical knowledge and should be approached with caution.
- Log in to the server via FTP or through the hosting management panel.
- Go to the WordPress root directory and find the “wp-config.php” file.
- Open the file for editing and add the following lines of code, replacing “http://new-domain.pl” with the address of your new domain:
define('WP_HOME','http://new-domain.pl'); define('WP_SITEURL','http://new-domain.pl');
- Save and close the file.
This concludes our guide to fixing WordPress redirect to old domain after migration issue. Remember that any change, especially a manual one, carries some risk, so it is always advisable to perform a full backup of your website and database before making any changes. If none of the above methods work, it is worth consulting a professional WordPress developer or a company that specializes in servicing this platform.