# Fix broken images

- Check 16.15 · Images and multimodal search · Important
- Source: https://checklist-seo-geo.com/en/images-multimodal-search/fix-broken-images
- Find images returning 404 or 403 errors with a crawler, your logs or the browser, identify the cause and fix it on Apache, Nginx, AWS, WordPress or Laravel.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/images-multimodal-search/fix-broken-images.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A broken image is an image that a page requests but that the server does not deliver: a 404, 403 or 5xx error, the wrong file type, or a malformed URL. Visitors see an empty frame or a missing image icon, and search engines have nothing to index. The task is to find these images across the whole site, identify their cause (moved file, migration, missing variant, access permissions) and fix the source rather than the symptom.

## Why it matters

An image that does not load exists neither for visitors nor for Google Images. On a product page, it is often the main photo that is missing; on a guide, the diagram that carried the explanation. The page looks neglected and loses value, even though the content has not changed.

Images break for very concrete reasons: a migration that changes the domain or switches to HTTPS without rewriting the URLs in the content, a file deleted from the Media Library but still inserted in an article, a CDN change, an image size that was never generated, a symbolic link forgotten during deployment. They also break silently: the page returns 200, no Search Console report lists image files with errors, and nobody notices without checking.

Responsive variants add a trap: with `srcset`, the browser picks a file based on the screen. A missing variant can therefore break the image on mobile only, while the desktop test passes.

## What it improves

- **Visitor experience**: no more empty frames or shifted layouts.
- **Image indexing**: an image that returns 200 can be crawled and indexed.
- **Conversion**: on a product page, the photo is often the deciding factor.
- **Crawling**: fewer requests wasted on errors in logs and crawl stats.
- **Web page rankings**: no known direct effect; the effect comes from the perceived quality of the page.

## How to check

**On a page, in the browser.** Open the developer tools, Network tab, “Img” filter, and reload: the lines in red (404, 403) are the broken images. Or, in the console:

```js
[...document.images].filter(i => i.complete && i.naturalWidth === 0).map(i => i.currentSrc || i.src);
```

Run the test again in mobile mode (device emulation toolbar) for images with a `srcset`.

**Across the whole site, with Screaming Frog.** Make sure image crawling is enabled (`Configuration > Spider > Crawl`, Images, plus extracting images from the `srcset` attribute), run the crawl, then go to the Response Codes tab, Client Error (4xx) filter. The Bulk Export menu, Response Codes section, exports 4xx errors along with the pages that request them (inlinks): that is your working list.

**In the server logs.**

```bash
awk '$9 ~ /^(403|404|410)$/ && $7 ~ /\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/ {print $9, $7}' /var/log/nginx/access.log \
  | sort | uniq -c | sort -rn | head -30
```

The referrer field of the same lines shows the page requesting the image.

**On Google's side.** [URL Inspection](https://search.google.com/search-console?action=inspect) of a page, “Test live URL”, then “View tested page”, “More info” tab, lists the resources Google could not load.

## How to implement

### Before you start

Classify each error by cause: the fix follows from it.

| Symptom | Likely cause | Fix |
|---|---|---|
| 404 on `http://ancien-domaine.fr/...` | Migration or HTTPS switch not carried over to the content | Search and replace in the database, 301 redirect at server level |
| 404 on `image-800x600.jpg`, the original exists | Size not generated or deleted | Regenerate the sizes |
| 404, file deleted | Image removed from the Media Library but still in use | Reinsert, replace or remove it from the page |
| 404 on `Photo.JPG`, the file is called `photo.jpg` | Different case on a Linux server | Fix the reference or rename |
| 403 on every image in a bucket | Storage access permissions | Access policy or a CDN in front of the bucket |
| 404 on `/storage/...` (Laravel) | Missing symbolic link | `php artisan storage:link` |
| Image blocked over HTTPS | Image requested over `http://` on an HTTPS page | Switch the URL to `https://` or a relative path |
| Image from a third-party site returns 404 | Remotely linked (hotlinked) image has disappeared | Host the image yourself, with the rights |

Order of priority: main images of pages that receive traffic, then product pages, then everything else. For an image removed on purpose, also remove the `img` tag: a deliberate 404 on an image that is no longer requested anywhere is not a problem.

When an image has moved and was receiving traffic from Google Images or external links, 301-redirect the old URL to the new one: Google asks you to treat image URLs like any other URLs during a site move.

### Apache

Versions: Apache 2.4.

Redirect an old images folder to the new one, in `.htaccess` or the virtual host:

```apache
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^img/produits/(.+\.(?:jpe?g|png|webp|avif))$ /media/produits/$1 [R=301,L,NC]
</IfModule>
```

For a Linux server that receives references with the wrong case, `mod_speling` with `CheckCaseOnly On` fixes the case with a redirect; it is better to fix the references in the content.

Reload if you change the server configuration: `sudo apachectl configtest && sudo systemctl reload apache2`.

### Nginx

Versions: Nginx 1.18 and later.

```nginx
location ~* ^/img/produits/(.+\.(?:jpe?g|png|webp|avif))$ {
    return 301 /media/produits/$1;
}
```

By default, Nginx writes every file not found to the error log: keep this behavior (`log_not_found on;`) during the audit. `sudo nginx -t && sudo systemctl reload nginx`.

### Cloudflare

Versions: Cloudflare dashboard, all plans, November 2026.

- After fixing at the origin, purge the affected URLs: [`Caching > Configuration`](https://dash.cloudflare.com/?to=/:account/:zone/caching/configuration), “Custom Purge”, otherwise Cloudflare may keep serving a cached error.
- To redirect old image URLs in bulk, create a redirect rule (`Rules > Overview`, [rules](https://dash.cloudflare.com/?to=/:account/:zone/rules/overview)) with a wildcard pattern: request URL `https://example.com/img/produits/*`, target URL `https://example.com/media/produits/${1}`, status code 301.
- If images go through Cloudflare's transformations (`/cdn-cgi/image/...`), an error on the source image produces an error on the transformed URL: test the source URL first.

### AWS

Versions: AWS console and AWS CLI v2 (S3, CloudFront), November 2026.

**S3** returns `403 Access Denied`, not 404, for a missing object when the requester is not allowed to list the bucket: a missing image then looks like a permissions problem. First check that the object exists:

```bash
aws s3 ls s3://example-images/media/produits/sencha-infusion.jpg
```

Also watch out for case and spaces: S3 keys are case-sensitive, and a name containing a space must be encoded (`%20`) in the URL.

**CloudFront** caches error responses for the duration configured in the distribution's `Error pages` tab. After fixing, create an invalidation:

```bash
aws cloudfront create-invalidation --distribution-id EDFDVBD6EXAMPLE --paths "/media/produits/*"
```

### Shared hosting

List the errors from the host's statistics or from the downloadable raw logs (often in a `logs` folder, or in cPanel under Metrics, “Raw Access”). Fix them with the file manager or over FTP (missing file, case of the name) and add redirects to `.htaccess` (Apache section).

### WordPress

Versions: WordPress 6.4 and later, WP-CLI 2.

**After a migration** or a switch to HTTPS, replace the old URLs in the database with WP-CLI, starting with a dry run:

```bash
wp search-replace 'http://ancien.example.com' 'https://example.com' --skip-columns=guid --dry-run
wp search-replace 'http://ancien.example.com' 'https://example.com' --skip-columns=guid
```

Without SSH access, the Better Search Replace plugin does the same operation from `Tools`. Make a backup first.

**Missing sizes** (the theme requests `photo-768x512.jpg`, which does not exist):

```bash
wp media regenerate --only-missing --yes
```

**Deleted images still in use**: search for the file name in the content.

```bash
wp db query "SELECT ID, post_title FROM wp_posts WHERE post_content LIKE '%sencha-infusion%' AND post_status = 'publish';"
```

Adapt the `wp_` prefix to your installation's. A link checking plugin such as Broken Link Checker helps with ongoing monitoring; check in its settings that it also checks images.

### Shopify

Versions: Shopify admin and Online Store 2.0 themes, all plans, November 2026.

Product images and files are served by Shopify: a broken image almost always comes from a reference in the theme or in content (an image deleted from `Content > Files` but still inserted in a page or a blog post, a URL copied from another site). Replace the reference in the editor, or upload the file again and update the URL. In the theme code, use the `image_url` and `image_tag` filters rather than hard-coded URLs.

### Laravel

Versions: Laravel 10 to 13.

Files stored on the `public` disk are served from `public/storage`, a symbolic link to `storage/app/public`. If it is missing, every image uploaded by users returns 404:

```bash
php artisan storage:link
```

Add this command to your deployment script. With release-based deployments (`releases` and `current` folders), check that `storage` is shared between releases, otherwise uploaded files disappear at every deployment. Generate URLs with `Storage::url($path)` or `asset()`, never with a hard-coded domain.

### Next.js

Versions: Next.js 15 and 16.

- **Remote images**: the `next/image` component rejects undeclared domains and the image is not displayed. Declare them in `images.remotePatterns` in `next.config.ts` (or `next.config.js`); the old `images.domains` option has been deprecated since Next.js 14:

```ts
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      { protocol: 'https', hostname: 'cdn.example.com', pathname: '/media/**' },
    ],
  },
};

export default nextConfig;
```

- **Images from a local IP address**: since Next.js 16, the optimizer rejects by default images served from a local or private IP address (a CMS or storage on the internal network). Serve them through a public domain name; only enable the `images.dangerouslyAllowLocalIP` option on a trusted private network.
- **`localPatterns`**: if this option is set, any local image outside the declared paths (or with an unexpected query string, such as `?v=2`) returns 400 instead of being optimized.
- **Files in the `public` folder**: they are served from the root. `public/images/sencha.jpg` is requested as `/images/sencha.jpg`, without `public` in the path.
- **Case sensitivity**: a name that works locally on macOS can break in production on Linux.

### Monitor over time

Schedule a monthly crawl that exports images with errors (see [schedule automated crawls](https://checklist-seo-geo.com/en/automation-quality-control/schedule-automated-crawls)), and add an image check to the acceptance testing of every redesign.

## Common mistakes

- **Testing on desktop only**: a missing `srcset` variant only breaks the image on mobile.
- **Redirecting every missing image to a default image**: Google and visitors get an unrelated image, and the real errors disappear from reports.
- **Returning an HTML 404 page with a 200 status code** for a missing image: the browser receives HTML instead of an image.
- **Fixing links in the database without a dry run**: `wp search-replace` without `--dry-run` on the wrong string can break far more than it fixes.
- **Forgetting caches** (CDN, caching plugin, CloudFront) after the fix.
- **Linking to images hosted on other sites**: they disappear without warning, and you often do not have the rights to them.
- **Forgetting images in `og:image` tags and structured data**: they are not displayed on the page but are used for shares and rich results.

## Frequently asked questions

### Do broken images hurt SEO?

A broken image is not a penalty, but it can neither be indexed nor appear in Google Images, and it degrades the page for visitors. On a product page or a guide where the image carries the information, the page loses part of its value. First fix the main images of pages that receive traffic, then handle the rest during a regular crawl.

### Does Search Console report images returning 404 errors?

Not directly. Search Console's indexing reports list pages, not the image files those pages request. For a given page, URL Inspection with a live test shows the resources Google could not load. For the whole site, use a crawler such as Screaming Frog with image crawling enabled, or filter the server logs for errors on image extensions.

### Should old image URLs be redirected after a redesign?

Yes, for images that were receiving traffic from Google Images or links from other sites. Google asks you to include images in the redirect map of a site move, just like pages. A 301 redirect from the old URL to the new one passes on the traffic and avoids errors. For images with no traffic or links, updating the references in the pages is enough.

### Why do my Laravel images return 404 after a deployment?

Most often, the public/storage symbolic link does not exist on the server. Files stored on the public disk are kept in storage/app/public and served through this link. Run php artisan storage:link and add the command to your deployment script. With release-based deployments, also check that the storage folder is shared between releases.

## Resources

- [Google Search Central: image SEO best practices](https://developers.google.com/search/docs/appearance/google-images?hl=en)
- [Google Search Central: site moves with URL changes](https://developers.google.com/search/docs/crawling-indexing/site-move-with-url-changes?hl=en)
- [WP-CLI: search-replace command](https://developer.wordpress.org/cli/commands/search-replace/) and [media regenerate command](https://developer.wordpress.org/cli/commands/media/regenerate/)
- [Laravel: file storage, the public disk](https://laravel.com/docs/filesystem#the-public-disk)
- [Next.js: image configuration, remotePatterns](https://nextjs.org/docs/app/api-reference/components/image#remotepatterns)
- [Amazon S3: troubleshooting access denied errors](https://docs.aws.amazon.com/AmazonS3/latest/userguide/troubleshoot-403-errors.html)

Next steps: [fix broken links](https://checklist-seo-geo.com/en/internal-linking/fix-broken-links) and [create a comprehensive redirect map](https://checklist-seo-geo.com/en/redesign-migration/create-comprehensive-redirect-map).
