How to manage the strong impact on Performance (serverside and clientside) of 404 Pages: how to solve?

Question

When a non-existing image is asked to the server hosting WordPress, it returns a standard 404 page which result in:

  • PHP having to render a page which cannot be cached and loads ALL the plugins
  • 152 server requests
  • 1.2 MB transferred
  • a load time of 3 seconds

I found out that I can avoid this mess with a .htaccess rule at the beginning of the file, but sometimes this breaks some Cache Plugin and however it doesn’t help with the broken url.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .(css|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ - [nocase,redirect=404,last]

Howw can I implement something similar inside the PHP? Is there any hook / filter to achieve a similar task?

0
, Revious 3 days 0 Answers 6 views 0

Thousands of WordPress themes to start your new website with a bang.

Leave an answer