How to Change Your WordPress URL and Fix Broken Image Links (Complete Guide)
Website Technical Support
Author: Leo MA
05/04/2026
Changing your WordPress website URL is a common task during domain migration or rebranding. However, if not handled correctly, it can lead to broken links, missing images, and site errors.
In this guide, we’ll walk you through:
- How to safely change your WordPress site URL
- How to update your database
- How to fix broken image links after migration
- Essential post-migration steps
Before You Start
Before making any changes, you should:
- Ensure your new domain DNS is correctly pointed to your hosting
- Take a full backup of your website and database
- Confirm you have access to cPanel and phpMyAdmin
Failing to do so may result in data loss or site issues.
Step 1: Change Your WordPress URL
Method 1 (Recommended): Update via wp-config.php
This is the fastest and safest method.
Steps:
- Log in to cPanel
- Open File Manager
- Navigate to your WordPress root folder (usually
public_html) - Edit the file:
wp-config.php - Add the following code:
define(‘WP_HOME’, ‘https://your-new-domain.com’);
👉 Replace your-new-domain.com with your actual domain.
Method 2: Update via Database (phpMyAdmin)
If the first method doesn’t work, update your database directly.
Steps:
- Log in to cPanel → phpMyAdmin
- Select your WordPress database
- Open the table:
wp_options - Locate:
siteurlhome
- Update both values to your new domain
Step 2: Fix Broken Image Links
After changing your domain, images may still point to the old URL, causing them not to load.
This happens because WordPress stores image URLs inside the database.
Fix Using SQL (Recommended)
Steps:
- Go to cPanel → phpMyAdmin
- Select your database
- Click the SQL tab
- Run the following query:
👉 Replace:
old_url→ your old domainnew_url→ your new domain
Important Warning
- Always back up your database before running SQL queries
- Incorrect queries can break your entire website
Step 3: Update Remaining URLs (Search & Replace)
Even after fixing images, your database may still contain old URLs in:
- Pages
- Posts
- Theme settings
- Plugins
Recommended solution:
Use a search-and-replace plugin to update all remaining references.
Step 4: Clear Cache
If your site uses caching plugins (e.g. WP Super Cache, W3 Total Cache), clear all caches.
Otherwise, changes may not appear immediately.
Step 5: Elementor Users (If Applicable)
If your website uses Elementor:
- Go to Elementor → Tools → Replace URL
- Enter:
- Old URL
- New URL
- Click Replace URL
- Go to General → Regenerate CSS
Step 6: Final Checks
After completing everything:
- Verify your site loads correctly
- Check images and internal links
- Re-save permalinks (Settings → Permalinks)
- Test forms and functionality
Common Issues After URL Change
1. Broken images
✔ Fix using SQL replace query
2. Mixed content (HTTP/HTTPS)
✔ Ensure SSL is installed and URLs use HTTPS
3. Redirect loops
✔ Check .htaccess and caching plugins
4. Missing styles (CSS)
✔ Regenerate CSS (especially for Elementor)
Pro Tips
- Always perform migrations on a staging environment first
- Use 301 redirects to preserve SEO
- Update Google Search Console after domain change
- Keep backups before and after changes
Conclusion
Changing your WordPress URL is straightforward when done correctly, but it involves more than just updating a domain. You must also:
- Update database references
- Fix image links
- Clear caches
- Test your entire site
Following this process ensures a smooth migration with no broken content or SEO loss.
