[wp-trac] [WordPress Trac] #11884: mod_rewrite optimization
WordPress Trac
wp-trac at lists.automattic.com
Sun Mar 13 08:58:55 UTC 2011
#11884: mod_rewrite optimization
-------------------------------+-----------------------
Reporter: Denis-de-Bernardy | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: Optimization | Version: 3.0
Severity: normal | Resolution:
Keywords: close 2nd-opinion |
-------------------------------+-----------------------
Comment (by g1smd):
Avoiding the two slow and inefficient disk reads (for requests that are
generally not going to be rewritten) sees a measurable increase in server
efficiency.
Although there may be "110 file types", applying this thinking purely to
the requests for images already sees improved handling for 90% or more of
non-HTML server requests.
Mod_rewrite offers a lot of powerful features, written to be highly
efficient, but most Open Source developers ignore all of this and simply
code
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
which is the absolutely worst way of doing it.
With this method you then have to write PHP code to "understand" what
"type of" request was made and call the right module to deal with that
request.
This functionality could have been far more efficiently coded using a
compact RegEx and rewrite function in .htaccess. However, this can only be
done of there is a cohesive plan for how the URL space used by a site is
divided up: and therefore a simple way for different types of content to
each specifically match a single RegEx.
It seems that database coding comes first, and "how this impacts the URL
space of the site" comes last, if indeed it is even addressed at all.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11884#comment:17>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list