Make sure you reference the image the right way. This image will be loaded from https://your-website.com/people-having-lunch.jpg
. Use absolute or relative URLs the right way:
Reference by using a relative url:
<!-- Hosted on: https://example.com -->
<!-- Example 1: current page: https://example.com/my-restaurant -->
...
<img src="/people-having-lunch.jpg" alt="People having lunch at our restaurant" />
...
<!-- Image will be loaded from: https://example.com/people-having-lunch.jpg -->
<!-- Example 2: current page: https://example.com/my-restaurant -->
...
<img src="people-having-lunch.jpg" alt="People having lunch at our restaurant" />
...
<!-- Image will be loaded from: https://example.com/my-restaurant/people-having-lunch.jpg -->
Or by using an absolute url:
<!-- Hosted on: https://example.com -->
<!-- Example 3: current page: https://example.com/my-restaurant -->
...
<img src="https://example.com/people-having-lunch.jpg" alt="People having lunch at our restaurant" />
...
<!-- Image will be loaded from: https://example.com/people-having-lunch.jpg -->
<!-- Example 4: current page: https://example.com/my-restaurant -->
...
<img src="../people-having-lunch.jpg" alt="People having lunch at our restaurant" />
...
<!-- Image will be loaded from: https://example.com/people-having-lunch.jpg -->
Or by using a relative url with a base href:
<!-- Hosted on: https://example.com -->
<!-- Example 5: current page: https://example.com/my-restaurant -->
...
<base href="https://example.com/" />
<img src="people-having-lunch.jpg" alt="People having lunch at our restaurant" />
...
<!-- Image will be loaded from: https://example.com/people-having-lunch.jpg -->
And of course (but easy enough to miss): make sure you use the right file extension for your image in your HTML and CSS. Watch out for spaces and other non-standard characters in your image names. Use dashes instead of spaces. Browsers url-encode spaces and other characters in URLs. Your web server might not be able to look up the image which results in a broken image icon on your website. Browsers can cache images, even if they are broken. Remove the cache for the specific website by doing a hard refresh: The easiest way to fix a broken image icon that is caused by a cache policy as a website owner is to rename the image. Replace all references in HTML and CSS with the new image name. All clients will now load the new image because it wasn't cached yet by the browsers. Web servers and reverse-proxies like Nginx can cache 404 Not Found errors in order to send a response faster. If the file is put in place, after the 404 response was cached, you need to clear your cache. How you clear server-side cache depends on the web server you are using. You can try to restart the server which clears in-memory caches. Test your website for freeSpaces and other special characters in image file names
Broken image due to Cache policy
Server-side broken image caching
Fix broken images now
ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.