[wp-trac] [WordPress Trac] #20746: Accessing non-existing theme folder in Network install gives 500 error

WordPress Trac noreply at wordpress.org
Sat Feb 22 18:20:42 UTC 2014


#20746: Accessing non-existing theme folder in Network install gives 500 error
---------------------------+------------------------------
 Reporter:  arkimedia      |       Owner:
     Type:  defect (bug)   |      Status:  reopened
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:  3.3.2
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  multisite
---------------------------+------------------------------

Comment (by jrfoell):

 I confirmed that the Ron Rennick / Pippin suggestion did not work for me
 on Apache 2.4.6 (added to a fresh WP 3.8.1 multisite subfolder install).
 The following seems to work, but it is not elegant and I haven't
 determined if it has other adverse effects:

 {{{
 RewriteCond %{REQUEST_FILENAME} -f [OR]
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^ - [L]
 # start new
 RewriteCond %{REQUEST_URI} ^/wp-(content|admin|includes).*$ # look for
 beginning slash
 RewriteRule ^ - [S=2] # skip to index.php
 # end new
 RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
 RewriteRule . index.php [L]`
 }}}

 The key is really noticing the difference between "wp-
 content/uploads/2013/10/test.jpg" and "/wp-
 content/uploads/2013/10/test.jpg" - with or without a beginning slash - so
 Apache doesn't go looking for a file outside of the webroot.

 Some of this seems to go against the documentation regarding "Per-
 directory Rewrites" found here:
 http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule
 specifically the second-to-last point:

 `The removed prefix always ends with a slash, meaning the matching occurs
 against a string which never has a leading slash. Therefore, a Pattern
 with ^/ never matches in per-directory context.`

 But I could be reading it wrong.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20746#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list