501 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

736 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.

501 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

736 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by