Fix broken links after moving my WordPress site to a new domain
If you find broken images and hyperlinks throughout your WordPress site after changing a domain, follow these steps to remove outdated link paths.
- Sign in to WordPress.
- From the Plugins menu, select Add New.
- Type Better search replace.
- Find the Better Search Replace plugin and select Install Now.
- When the plugin has installed, select Activate.
- From the Tools menu, select Better Search Replace.
- Enter your site's old URL in the Search for field. For example, http://olddomainexample.com (no trailing slash).
- Enter your site's new URL in the Replace with field. For example, http://newdomainexample.com (no trailing slash).
- In the Select tables field, select all the database tables in the list.
- Leave the Run as dry run checkbox selected and then select Run Search/Replace. That way, you can check the results beforehand.
- Select Click here to see in which database tables URLs will be replaced, and a window with the results will pop up.
- Clear the Run as dry run checkbox.
- Select Run Search/Replace to replace the URLs in the database.
Note: If you don’t want to check the results before you initiate the actual change in the database, continue from step 12. However, we advise following the next two steps to make sure that unwanted changes won't occur.
If you also moved a website to a different server, please check if a custom upload path option is available under Settings > Media. If you don't see this option, no further actions are required. On the other hand, if this field is available, remove the entry to reset the media upload path to a default one for a new server and select Save Changes.