If you’re going to implement your custom wordpress search (not wordpress native) on search.php template – for example using Google Custom Search or Bing – you might have everything working ok, but wordpress is still performing search queries to database which can slow down your site. This is because wordpress treats search.php template as search page, no matter what is inside and prepares post list before it’s loaded.
So to avoid this, you need to use the following code:
WordPress has a 404.php template that’s generated for not found posts/pages. That’s fine, but what happens if post contains an image that’s deleted or moved from your blog or just path is set incorrect? It will output this 404.php template to the browser that’s actually doubles the traffic for a single page (for every not found object it will multiply traffic/load for every page)! Also, some bot’s request some strange urls never existed on your site that also slows down the server. To fix that I recommend to add elegant rules to WP’s .htaccess file:
This is a preview of
Improving WordPress .htaccess – optimize WP’s 404 response
. Read the full post (189 words and 1 image, estimated 45 secs reading time)