[wp-trac] [WordPress Trac] #11884: mod_rewrite optimization
WordPress Trac
wp-trac at lists.automattic.com
Sat Feb 26 00:08:03 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 sivel):
Replying to [comment:10 g1smd]:
> What is the mechanism for a URL request serviced by "WP_rewrite"? You're
saying those are URL requests that are rewritten to the index.php script
and then handled from there?
>
> Just to be clear, you are saying that a request for /someimage.jpg (for
example) is rewritten to the index.php script and the index.php script
sends an image back?
In the only public example I have to show currently,
http://paste.sivel.net/embed/24.js is not a real file. It is generated
similar to the way a post is. The request comes in, the file doesn't
exist so it is sent to index.php and processed. WP_Rewrite has a regex
pattern looking for this type of URL, and in the end gets the request to a
custom template file within my theme, based off of internal query vars the
same way that a post is rendered. In this case I send the correct HTTP
headers for a JS file, and output some JS.
I have other applications built off of WP which are not publicly
accessible which generate documents, css and images in this manner.
So basically yes, requests to non-existent files such as image files,
PDFs, JS are rewritten to index.php via the current .htaccess, which then
processes the request using custom rewrite rules via WP_Rewrite, and
delivers back the expected type of content.
Adding rewrite rules to exclude images, js, css, etc would not permit this
to work.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11884#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list