491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

I just noticed the following line in the .htaccess of a wp network install

...
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
...

while i can understand the reasons behind such implementation, the above rule still causes a massive drop in server performances because all uploads are served via php (like timthumb)

a quick fix

RewriteCond %{HTTP_HOST} ^theme4\.themes\.domain.com$ [NC]
RewriteRule ^files/(.+) wp-content/blogs.dir/5/files/$1 [L]

RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

where theme4.themes.domain.com is a site of the newtwork with siteID = 5 this way, uploads will be again served directly by the webserver.

I guess other theme authors here may use a newtwork installation for their previews so decided to share.

BF

731 posts
  • Elite Author
  • Attended a Community Meetup
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Exclusive Author
  • Most Wanted Bounty Winner
+2 more
mordauk says

If it makes a significant improvement, you should submit this as a patch to WP core.

491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

If it makes a significant improvement, you should submit this as a patch to WP core.

as i said, there are reason for that – for example, the php file checks

if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
        status_header( 404 );
        die( '404 — File not found.' );
}

the above wouldn’t be possible without using ms-files.php. However, such feature is not needed when the network is only used for theme preview, hence the quick hack.

BF

731 posts
  • Elite Author
  • Attended a Community Meetup
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Exclusive Author
  • Most Wanted Bounty Winner
+2 more
mordauk says

Ah, that makes sense.

by
by
by
by
by
by