Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've two wp sites (multisite) with the following config:

1#

(Main site) Home: http:// www.mysite.com

Upload Path: wp-content/uploads

Fileupload Url: http:// www.mysite.com/wp-content/uploads

2#

Home: http:// www.mysite.com/en/

Upload Path: wp-content/blogs.dir/2/files

Fileupload Url: http:// www.mysite.com/en/files

My .htaccess has the following:

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

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress

The first site is working 100%, i can upload images, view them on the media library & post edit and they show OK in the page

The second site, when I upload the image, it shows a broken image: http://i.stack.imgur.com/EsMg4.gif

But when I click the "edit image" button it shows OK: http://i.stack.imgur.com/5gMIH.gif

I've checked and the image is on the right folder (http: //www.mysite.com/blogs.dir/2/files/honey.jpg) but it's broken in the admin panel and the site. The url of the broken image is: http: //www.mysite.com/en/files/honey.jpg

I've lost hours trying to fix it through .htaccess and changing the wordpress config but nothing seems to work. Any ideas?

Thanks!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

After reading several topics about this issue I've found this:

Issues with old WPMU installs

If you installed WordPress MU in subfolder/subdirectory (not in root folder on your server >via ftp) and you have problem with image library, where thumbnails and images do not show, >you may need to manually add in rewrite rules for your file directories as follows:

RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

Put those below the normal call for uploaded files.

However, this didn't work, i had to replace (or comment) the uploaded files line and change the new one to work in all sites. In the end this is the .htaccess that worked OK:

# uploaded files
# RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-content/blogs.dir/N/files/$2 [L]

Being 'N' the number of my non-primary site

So, I guess that for each site, you have to add another line changing the number. Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.