[wpmu-trac] [WordPress MU Trac] #286: Rewrite rules

WordPress MU Trac wpmu-trac at lists.automattic.com
Thu Mar 22 16:53:51 GMT 2007


#286: Rewrite rules
------------------------+---------------------------------------------------
 Reporter:  hovenko     |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  WPMU 1.0   
Component:  component1  |     Version:  1.0        
 Severity:  normal      |    Keywords:  mod_rewrite
------------------------+---------------------------------------------------
 I am working on Multi Site functionality for WordPress MU when I found out
 about this issue.

 In my Apache-configuration I have the following setup:

 {{{
 <Location /site2/blog>
   RewriteEngine On
   RewriteBase /site2/blog/

   # Rewrite www.domain.com to domain.com
   #RewriteCond %{HTTP_HOST} ^www\.(.*)
   #RewriteRule ^(.*)       http://%1/$1 [R,L]

   #uploaded files
   RewriteRule ^(.*/)?files/$ index.php [L]
   RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

   RewriteCond %{REQUEST_FILENAME} -f [OR]
   RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule . - [L]
   RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
   RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
   RewriteRule . index.php [L]
 </Location>
 }}}


 This is the content from the .htaccess file wrapped inside a location tag.
 Having the .htaccess file is unacceptable for me, since I am going to use
 Alias in the Apache configuration to deal with the multiple sites.

 With this setup I can not access the files from wp-content, wp-admin etc.
 when I am in one of my blogs. I found out that this had to do with this
 line:

 {{{
   RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
 }}}

 The (quick) solution was to remove the caret symbol:
 {{{
   RewriteRule  ([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
 }}}

 I dont know what Apache does different when matching URLs in location-tags
 and in .htaccess files, but it works for me know.

 Maybe someone with better knowledge of RewriteRule's in Apache can take a
 look at what the rule should look like to match only the nessecary, but to
 work in both of these cases.


 WordPress MU 1.1.1

-- 
Ticket URL: <http://trac.mu.wordpress.org/ticket/286>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser


More information about the wpmu-trac mailing list