495 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 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
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+7 more
mordauk says

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

495 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 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
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+7 more
mordauk says

Ah, that makes sense.

by
by
by
by
by
by