Skip to content

Instantly share code, notes, and snippets.

@finalwebsites
Created September 3, 2022 06:52
Show Gist options
  • Save finalwebsites/ce77b691730e4d3a0ff7884ef7e6b23c to your computer and use it in GitHub Desktop.
Save finalwebsites/ce77b691730e4d3a0ff7884ef7e6b23c to your computer and use it in GitHub Desktop.
Ignore missing files and report a 404 status
# add this code to your .htaccess file (Apache based servers only)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|png|gif|bmp|ico|css|js|swf|htm|html|txt|php|asp|aspx)$ [NC]
RewriteRule .* - [L,R=404]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment