Before hiding the images with old paths, it’s essential to understand what this process entails and what the risks involved.

Given that images don’t represent a security risk for your site, hiding them is not a necessity or something we recommend to increase your WordPress site’s protection.

From an SEO standpoint, if Google has already indexed the images, when someone lands on your site via Google Images, they will see a 404 Page Not Found error.

Even if you don’t use WP Ghost to hide images, over time, Google will index all media images with the new paths without affecting SEO.

However, if you still wish to hide the images with the old paths, follow the steps below:

Hide Old Image Paths

You can set the extension files you want to hide on the old paths from WP Ghost > Change Paths > WP Core Security > Hide WordPress Common Paths.

The image extensions that are included in the list are: jpeg, jpg, tiff, gif, bmp, png, webp.

define('HMW_HIDE_OLD_IMAGES', true);

and you will see the IMAGE files option in the Hide File Extensions list:

Select the IMAGE files and save the settings.

Redirect Images From the Old Paths to the New Paths

It is recommended that the same image not be used on two different URLs on a website to avoid duplicate content issues and maintain good search engine optimization (SEO) practices.

When search engines like Google detect duplicate content, it can negatively impact the website’s visibility and rankings in search results.

Select the MEDIA Files from WP Ghost > Change Paths > Hide WordPress Common Path > Hide File Extensions extension list.

By implementing this solution, any requests for images in the old /wp-content/uploads/ the directory will be redirected to the new /storage/ directory, preventing duplicate URLs for the same image.

Troubleshooting

If your theme or other plugins load images into CSS or JS, it’s possible for images to not load in the front end. A solution for this is using a cache plugin and activating the option to modify the paths in cache files using WP Ghost.