Support Center » Knowledgebase » Performance tip: Bypass Wordpress 404 handling for missing images

Performance tip: Bypass Wordpress 404 handling for missing images



By default, Wordpress is set to handle 404 errors. If you happen to have lots of missing images for some reason (e.g. trying to load nonexistent retina version), Wordpress 404 will be triggered many times. Sometimes one page load would cause Wordpress to load 5-50 times depending on how many 404 objects there are. This can seriously slow your site down. You can intercept 404s for jpg / png files by using a mod_rewrite rule before/above the default Wordpress rule. 
##### BEGIN 404 Load fix by Quadra Hosting
######### IMPORTANT!!!!! Place this ABOVE the Wordpress rules.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png|gif|js|css|ttf)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* - [R=404,L]
##### END 404 Load fix by Quadra Hosting


Article Details
Article ID: 226
Created On: 21 Jan 2016 11:50 AM
 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
Please note that the login and password to the support area is NOT the same as your hosting control panel login and password
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Downloads | Control Panel User's Guide | Server Status
Language: