htaccess rules for a WPMU 3.2.1 site with sub-domains

I am finding that performance is slow on my site when people upload files. Looking at the stacktrace, it’s pointing to /wp-includes/ms-files.php as the problem.

I wonder if this relates to our .htaccess rules, which are left over from when we ran WPMU 2.x

A more recent test install includes this:

# uploaded files

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

but our production install includes this:

#uploaded files

RewriteRule ^(.*/)?files/$ index.php [L]

RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

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

Can you tell me what the current, preferred htaccess rules are for a multisite network, using HTTPS for /wp-admin/ and sub-domains for blogs. Thank you.

  • aecnu
    • WP Unicorn

    Greetings josswinn,

    Unfortunately I cannot give you the htaccess file from WordPress MultiSite 3.2.1, since we support the newest versions of WordPress and plugins, therefore I only have access to the htaccess file for WordPress MultiSite 3.3.2 in which I have included below:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]

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

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    I personally do not think there will be a big difference in the htaccess code though in WordPress 3.3.2 the postname permalink structure and database interaction has been greatly improved.

    Hopefully this will help get you straightened out and it is my opinion that you should upgrade to the newest version of WordPress 3.3.2 asap.

    Be sure to make a full backup of your installation including database prior to upgrading.

    Thank you for being a WPMU Member!

    Cheers, Joe

  • uol
    • Design Lord, Child of Thor

    Thanks for this. I’m actually running 3.3.2 – made a mistake in the heading. These rules have improved things, but I’ve realised the best thing to improve performance has been to add APC and Batcache.

  • aecnu
    • WP Unicorn

    Greetings josswinn,

    Thank you for your feedback, it is greatly appreciated.

    I’ve realised the best thing to improve performance has been to add APC and Batcache.

    Caching certainly has it’s drawbacks and consequences, I prefer beef much more the cache :slight_smile:

    What kind of server do you have, like a Dual Quad Core Xeon with 8GB RAM? That should handle about a million hits a day?

    Cheers, Joe

  • aecnu
    • WP Unicorn

    Greetings josswinn,

    You would think that it could handle half a million hits a day without slowing down too much though of course not all at one time, but I must admit I am not a fan of blade servers due to possible I/O bottlenecks. Also we do not know what Xeon CPU’s the two are, in my rig I have two quad core Xeon’s that just scream.

    But my question was only relative to the need for caching and not to the issue you reported.

    Thank you for letting me know, and for real power information, if you know what the Xeons are, you can see their rating here:

    My personal machine that I am working with is indeed the I-7 2600K (rated 9,084) with the Radeon 6850 Video. My Dual Xeon server is the 5420 rated at 3763 each though I admit video will not be helpful to a server … lol

    Depending on the Xeons which code be actually quite low, the fact that cache has made a difference to you is what is important.

    Thank you for the interaction.

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.