Follow @BPSPro

The first step is creating the /blogs.dir folder manually.  This is the folder where your WordPress images will be uploaded to and stored in for your WordPress Network / MU sub sites.

Manually create a /blogs.dir directory under /wp-content/ >>> /wp-content/blogs.dir/
This directory is used to store uploaded media image files for your additional sub sites and must be writable by the web server.  The file permissions ( CHOWN and / or CHMOD) should be the same as your wp-content directory.

This is a known issue with WordPress Network / MU websites and is not something that specifically occurs when BPS is installed.  What is needed to correct the image display problem for both your backend Media Library and also your front end website display of images for WordPress Network / MU websites are .htaccess RewriteRules that will rewrite your sub site’s virtual URL path to your blogs.dir folder to display images with the correct “actual real” URL paths for your virtual WordPress Network / MU sub sites.

WordPress Network / MU Image .htaccess RewriteRule Example

For this example below I have a WordPress Network / MU Primary site installed in this folder >>> /wordpress/.
I have 2 sub sites >>> /blah1/ and /blah2/.
The full URL path to an example image file is this >>> http://www.example.com/wordpress/wp-content/blogs.dir/5/files/2011/11/vulnerable-to-SQL-Injection-attack.png

You need to find your actual real folder path to your /blogs.dir/ folder and if an additional numbered folder name (1, 2, 3, etc)  is included in that URL path then you will need to include the full correct URL path in your RewriteRule.  The .htaccess code shown below is the BPS .htaccess code for a WordPess Network / MU sub-directory website.  The same principle applies to WordPress Network / MU sub-domain websites.  More importantly this shows where in the BPS root .htaccess file you should add your image file RewriteRules for ALL of your sub sites.  By adding a RewriteRule for EACH of your sub sites your Media Library thumbnail images will display correctly and also your front end images will also display correctly.

# DENY ACCESS TO PROTECTED SERVER FILES - .htaccess, .htpasswd and all file names starting with dot
RedirectMatch 403 /\..*$

RewriteEngine On
RewriteRule ^blah1/files/(.*)$ http://www.example.com/wordpress/wp-content/blogs.dir/5/files/$1 [L,R=301]
RewriteRule ^blah2/files/(.*)$ http://www.example.com/wordpress/wp-content/blogs.dir/6/files/$1 [L,R=301]

RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]

Further explanation of what is happening by adding the Image File RewriteRule

In this example above the RewriteRule for sub site /blah1/ is told to rewrite URL’s that begin with /blah1/files/ to the portion of the URL path that needs to rewritten, which is everything up to the last part of the URL, which would be something like this /2011/11/vulnerable-to-SQL-Injection-attack.png.  The rest of the full URL path to the image file will be automatically included / added in the URL by using .htaccess (.*)$ and $1.  The end result is that the portion of your image URL’s that needs to be changed will be automatically rewritten to the actual real correct path to your image files and then the trailing portion of the URL /2011/11/vulnerable-to-SQL-Injection-attack.png will be automatically included in the final rewritten URL

WordPress Network / MU Sub domain Site Images Not Displaying 

This .htaccess code in your Root .htaccess file can cause images not to display for Network / MU sub domain websites.  Comment this code out by adding # signs in front of this .htaccess code shown below in your Root .htaccess file.  This .htaccess code will be removed for Network / MU sub domain sites AutoMagic in BPS Pro 5.1.3.

#RewriteEngine On
#RewriteBase /
#RewriteRule ^wp-admin/includes/ - [F,L]
#RewriteRule !^wp-includes/ - [S=3]
#RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
#RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
#RewriteRule ^wp-includes/theme-compat/ - [F,L]

Additional Information About BPS and WordPress Network / MU Websites

Do not Network Activate BPS.
BPS Should only be activated on the Primary Site.
BPS AutoMagic buttons should ONLY be used on the Primary Site
MU sub sites are virtual sites – BulletProof Modes should NOT be activated on sub sites
ONLY Super Admins can see the BPS menu in sub sites for both BPS Free and BPS Pro
If a Site Admin tries to view BPS Settings or BPS pages a Super Admins Permissions Error message is displayed

Skip to toolbar