This setup redirects missing image files (404 images) to a placeholder image during local development and helps avoid broken image issues.
Step 1: Add Placeholder Image Rule
Add the following code at the top of the .htaccess file:
Step 2: If Site Starts Downloading File Automatically
If opening the site causes the placeholder image to download automatically:
-
Delete the
.htaccessfile from the root folder -
Reload the website
-
Recreate
.htaccessby saving Permalinks again if required