John Davidson

php - Wordpress images not showing when migrated to localhost

0 comments
Message:


I recently started learning Wordpress about a few weeks ago. All-in-One WP Migration plugin helped me migrate a website from the web to my localhost. Upon uploading it to my local server, I noticed that no images are showing on the front end, other functions seems to be working just fine. I found out a while later that the reason as to why the it wasn't showing is because the path towards the images seems to be broken, thus producing a 404 error (image not found).


Images are pointing towards "localhost/wp-content/uploads/image.jpg" rather than "localhost/MyWebsite/wp-content/uploads/image.jpg" which I suspect is the reason as to why no images are showing.


Here are the plugins I mainly use:



  • Woocommerce (and other plugins related to this)

  • Jetpack

  • W3 Total Cache

  • All In One WP Security

  • Smush

  • WP Mail SMTP


Tried to deactivate all plugins and reverted the website to its default theme (twenty seventeen) but the issue still remains.


Thanks again for the help!



My Answer:
To fix this issue, you will need to update the image paths in your WordPress database. Here's how you can do it:

1. Install and activate the "Better Search Replace" plugin in your WordPress dashboard.

2. Go to Tools > Better Search Replace.

3. In the "Search for" field, enter your old URL path (e.g. localhost/wp-content/uploads/) and in the "Replace with" field, enter your new URL path (e.g. localhost/MyWebsite/wp-content/uploads/).

4. Select all tables by checking the box next to "Select all tables" option.

5. Uncheck the "Run as dry run?" option to actually replace the URLs in the database.

6. Click on the "Run Search/Replace" button.

This should update all the image paths in your database to point to the correct location. After running the search and replace, check your website to see if the images are now showing up correctly.

If the issue still persists, you may need to manually update the image paths in your theme files or media library. Make sure to also check your .htaccess file and wp-config.php file for any hardcoded URLs that may need to be updated.

If you're still facing issues, you may want to reach out to the All-in-One WP Migration plugin support team for further assistance.

Rate this post

4 of 5 based on 1304 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us