Cloud Service >> Knowledgebase >> WordPress >> How to Fix Image Links after a WordPress Migration?
submit query

Cut Hosting Costs! Submit Query Today!

How to Fix Image Links after a WordPress Migration?

1. Update URLs within the Database

If your image URLs are damaged because of a trade in the location name or listing, you could replace the URLs straight away inside the database.

Using a Plugin:

  • Step 1: Install and activate a plugin like Better Search Replace or Velvet Blues Update URLs.

  • Step 2: Go to the plugin settings.

  • Step 3: Enter the vintage URL (e.g., http://oldsite.Com) and the brand new URL (e.g., http://newsite.Com).

  • Step 4: Select the tables wherein the URLs need to be updated (usually wp_posts and wp_postmeta).

  • Step five: Run the hunt and update way.

Manually thru SQL Query:

  • Step 1: Access your WordPress database through phpMyAdmin or a similar tool.

  • Step 2: Run the following SQL question to replace antique URLs with brand-new ones:

 

UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://oldsite.com', 'http://newsite.com');

 

  • Note: Replace wp_ together with your real table prefix, if different.

  • Step three: Repeat the way for each different vital table (e.g., wp_postmeta).

2. Fix Image Links inside the Media Library

If the picture documents are still present but now not displaying correctly, you may want to regenerate thumbnails.

Using a Plugin:

  • Step 1: Install and activate the Regenerate Thumbnails plugin.

  • Step 2: Go to Tools > Regenerate Thumbnails.

  • Step 3: Click "Regenerate Thumbnails for All Attachments" to rebuild the picture sizes in your media library.

3. Update.Htaccess File

If your migration concerns moving to a distinctive listing or subdomain, you would likely want to update the. Htaccess report to handle redirects.

  • Step 1: Access your.Htaccess document through FTP or the document supervisor to your cloud hosting manage panel.

  • Step 2: Add a 301 redirect to element the vintage picture paths to the modern-day ones:

Redirect 301 /wp-content/uploads/old-folder/ http://newsite.com/wp-content/uploads/new-folder/

4. Correct File Permissions

Ensure that the photo files have suitable permissions after migration, specifically in case you transferred them manually.

  • Step 1: Use an FTP customer or report manager to navigate to the wp-content/uploads/ directory.

  • Step 2: Set the precise permissions, commonly 755 for directories and 644 for files.

5. Update Image Paths in the Theme Files

If your topic uses hardcoded URLs for snapshots, replace the ones manually:

  • Step 1: Go to Appearance > Theme File Editor.

  • Step 2: Check header.Php, footer.Hypertext Preprocessor, fashion.Css, and some other applicable files for hardcoded photo paths.

  • Step three: Replace the antique URLs with the latest ones.

  •  

6. Clear Cache

After making changes, easy your WordPress cache and browser cache to make sure the new links are meditated.

  • Step 1: If you're the usage of a caching wordpress plugin, visit the plugin settings and ease the cache.

  • Step 2: Clear your browser cache as well.

  •  

Testing:

Once you have completed those fixes, very well test your website to ensure all photographs are displaying efficiently. Check the media library and various pages to verify that the links have been well-updated.

 

These steps need to assist you restore photograph hyperlinks after migrating your WordPress internet site online.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!