Opened 2 years ago

Last modified 2 years ago

#17246 new enhancement

Handling of HTTP 404 errors for non-existing files

Reported by: azaozz Owned by:
Priority: normal Milestone: Future Release
Component: Performance Version:
Severity: normal Keywords: needs-patch
Cc:

Description

Generally if WordPress sees a request for a specific file it means the web server couldn't find that file. Currently we run all of WordPress in such cases and output the theme's 404 template.

If the missing file is an image that has been reused 10 times (perhaps a CSS background or sprite) we will run ten extra times on every page load.

What I'm proposing is to short-circuit all requests for specific files very early in the load cycle, the same way we do it for favicon.ico requests and output a generic 404 notice.

Change History (4)

comment:1 follow-up: ↓ 2   nacin2 years ago

See #11884 and probably other tickets.

comment:2 in reply to: ↑ 1   azaozz2 years ago

Replying to nacin:

Yes, there are few tickets and also ideas that talk about optimizing htaccess. If some of these are implemented they may handle this case too.

However I'm talking specifically about 404 errors. This is something we can do now and it wouldn't break even some "non-standard" plugins as the files they send the requests to exist. WordPress is generating JS and CSS in that way too, see load-scripts.php and load-styles.php.

comment:3   dd322 years ago

Things that come to mind here:

  • People with permastructs with .html etc in the url
  • People with custom rewrite rules to posts/etc which uses a form of /site/some/file/name.ext
  • Milestone changed from 3.2 to Future Release
Note: See TracTickets for help on using tickets.