My WordPress Multi-Site .htaccess File

I just solved my WordPress multi-site problem. I have several blogs located in the subdirectories of this blog. The problem was the media files for my sub-blogs were all broken.

If you are aware of the WordPress multi-site setup, WordPress creates a blog.dir directory under wp-content. This is where it keeps all of the uploaded media files such as: images, video, etc for the sub-blogs.

The issue was began when my .htaccess file was overwritten or possibly replaced. At first, I thought it was just an issue with the WordPress options pages which is stored in the wp-options table. But, that wasn’t the case.

A quick search in the WordPress forums solved that problem. So, I’m writing this article for two reasons: (1.) So others can benefit, (2.) so I have a record of this fix somewhere.

So, here’s my .htaccess file.

# Download Plugin
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^download/([^/]+)$ /wp-content/plugins/download-monitor/download.php?id=$1 [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
# uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

The Download section of the .htaccess file is for the Download Manager plugin.

If you enjoyed this article, please share it with others using the social buttons below. If you like to be updated when a new article is published, please subscribe via email, RSS or follow me on Twitter: @ulyssesonline.

  • Twitter
  • Facebook
  • Delicious
  • Digg
  • StumbleUpon
  • Google
  • LinkedIn
  • Google Reader
  • FriendFeed
  • Reddit
  • Tumblr
  • Live
  • PDF
  • Email
  • RSS
  • Add to favorites

Related Articles

No Comments