{"id":3454,"date":"2011-11-29T10:25:33","date_gmt":"2011-11-29T17:25:33","guid":{"rendered":"http:\/\/www.ait-pro.com\/aitpro-blog\/?p=3454"},"modified":"2012-01-01T16:54:08","modified_gmt":"2012-01-01T23:54:08","slug":"wordpress-network-mu-images-not-displaying-images-not-displaying-in-media-library-images-not-displaying-on-website","status":"publish","type":"post","link":"https:\/\/www.ait-pro.com\/aitpro-blog\/3454\/misc-projects\/wordpress-tips-tricks-fixes\/wordpress-network-mu-images-not-displaying-images-not-displaying-in-media-library-images-not-displaying-on-website\/","title":{"rendered":"WordPress Network MU Images Not Displaying &#8211; Images Not Displaying in Media Library, Images Not Displaying on Website"},"content":{"rendered":"<p>The first step is creating the \/blogs.dir folder manually. \u00a0This is the folder where your WordPress images will be uploaded to and stored in for your WordPress Network \/ MU sub sites.<\/p>\n<p>Manually create a \/blogs.dir directory under \/wp-content\/ &gt;&gt;&gt; \/wp-content\/blogs.dir\/<br \/>This directory is used to store uploaded media image files for your additional sub sites and must be writable by the web server. \u00a0The file permissions ( CHOWN and \/ or CHMOD) should be the same as your wp-content directory.<\/p>\n<p>This is a known issue with WordPress Network \/ MU websites and is not something that specifically occurs when BPS is installed. \u00a0What 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&#8217;s virtual URL path to your blogs.dir folder to display images with the correct &#8220;actual real&#8221; URL paths for your virtual WordPress Network \/ MU sub sites.<\/p>\n<h2><span style=\"color: #000066;\">WordPress Network \/ MU Image .htaccess RewriteRule Example<\/span><\/h2>\n<p>For this example below I have a WordPress Network \/ MU Primary site installed in this folder &gt;&gt;&gt; \/wordpress\/.<br \/>I have 2 sub sites &gt;&gt;&gt; \/blah1\/ and \/blah2\/.<br \/>The full URL path to an example image file is this &gt;&gt;&gt;\u00a0http:\/\/www.example.com\/wordpress\/wp-content\/blogs.dir\/5\/files\/2011\/11\/vulnerable-to-SQL-Injection-attack.png<\/p>\n<p>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) \u00a0is included in that URL path then you will need to include the full correct URL path in your RewriteRule. \u00a0The .htaccess code shown below is the BPS .htaccess code for a WordPess Network \/ MU sub-directory website. \u00a0The same principle applies to WordPress Network \/ MU sub-domain websites. \u00a0More importantly this shows where in the BPS root .htaccess file you should add your image file RewriteRules for ALL of your sub sites. \u00a0By 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.<\/p>\n<pre># DENY ACCESS TO PROTECTED SERVER FILES - .htaccess, .htpasswd and all file names starting with dot\r\nRedirectMatch 403 \/\\..*$\r\n\r\nRewriteEngine On\r\nRewriteRule ^blah1\/files\/(.*)$ http:\/\/www.example.com\/wordpress\/wp-content\/blogs.dir\/5\/files\/$1 [L,R=301]\r\nRewriteRule ^blah2\/files\/(.*)$ http:\/\/www.example.com\/wordpress\/wp-content\/blogs.dir\/6\/files\/$1 [L,R=301]\r\n\r\nRewriteEngine On\r\nRewriteBase \/wordpress\/\r\nRewriteRule ^wp-admin\/includes\/ - [F,L]\r\nRewriteRule !^wp-includes\/ - [S=3]\r\nRewriteRule ^wp-includes\/[^\/]+\\.php$ - [F,L]\r\nRewriteRule ^wp-includes\/js\/tinymce\/langs\/.+\\.php - [F,L]\r\nRewriteRule ^wp-includes\/theme-compat\/ - [F,L]\r\n<\/pre>\n<h2><span style=\"color: #000066;\">Further explanation of what is happening by adding the Image File RewriteRule<\/span><\/h2>\n<p>In this example above the RewriteRule for sub site \/blah1\/ is told to rewrite URL&#8217;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. \u00a0The rest of the full URL path to the image file will be automatically included \/ added in the URL by using .htaccess (.*)$ and $1. \u00a0The end result is that the portion of your image URL&#8217;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\u00a0\/2011\/11\/vulnerable-to-SQL-Injection-attack.png will be automatically included in the final rewritten URL<\/p>\n<h2><span style=\"color: #000066;\">WordPress Network \/ MU Sub domain Site Images Not Displaying\u00a0<\/span><\/h2>\n<p>This .htaccess code in your Root .htaccess file can cause images not to display for Network \/ MU sub domain websites. \u00a0Comment this code out by adding # signs in front of this .htaccess code shown below in your Root .htaccess file. \u00a0This .htaccess code will be removed for Network \/ MU sub domain sites AutoMagic in BPS Pro 5.1.3.<\/p>\n<pre>#RewriteEngine On\r\n#RewriteBase \/\r\n#RewriteRule ^wp-admin\/includes\/ - [F,L]\r\n#RewriteRule !^wp-includes\/ - [S=3]\r\n#RewriteRule ^wp-includes\/[^\/]+\\.php$ - [F,L]\r\n#RewriteRule ^wp-includes\/js\/tinymce\/langs\/.+\\.php - [F,L]\r\n#RewriteRule ^wp-includes\/theme-compat\/ - [F,L]<\/pre>\n<h2><span style=\"color: #000066;\">Additional Information About BPS and WordPress Network \/ MU Websites<\/span><\/h2>\n<p>Do not Network Activate BPS. <br \/>BPS Should only be activated on the Primary Site. <br \/>BPS AutoMagic buttons should ONLY be used on the Primary Site<br \/> MU sub sites are virtual sites \u2013 BulletProof Modes should NOT be activated on sub sites <br \/>ONLY Super Admins can see the BPS menu in sub sites for both BPS Free and BPS Pro<br \/>If a Site Admin tries to view BPS Settings or BPS pages a Super Admins Permissions Error message is displayed<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The first step is creating the \/blogs.dir folder manually. \u00a0This 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\/ &gt;&gt;&gt; \/wp-content\/blogs.dir\/This directory is used to store uploaded media image files for your additional sub sites [&hellip;]<\/p>\n","protected":false},"author":167,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[13],"tags":[459,458,456,457,455],"class_list":["post-3454","post","type-post","status-publish","format-standard","hentry","category-wordpress-tips-tricks-fixes","tag-wordpress-media-library-images-not-displaying","tag-wordpress-mu-htaccess-code","tag-wordpress-mu-images-not-displaying","tag-wordpress-network-htaccess-code","tag-wordpress-network-images-not-displaying"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/posts\/3454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/users\/167"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/comments?post=3454"}],"version-history":[{"count":0,"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/posts\/3454\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/media?parent=3454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/categories?post=3454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ait-pro.com\/aitpro-blog\/wp-json\/wp\/v2\/tags?post=3454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}