How to replace “wp-content/blogs.dir” with “media” for attachment permalinks in a multisite environment?

This is how links look now:

http://url.com/wp-content/blogs.dir/21/files/2011/06/650026_x640_21.jpg
-or-
http://subdomain.url.com/wp-content/blogs.dir/21/files/2011/06/650026_x640_21.jpg

Ideally this is how the would look:

http://url.com/media/2011/06/650026_x640_21.jpg
-or-
http://subdomain.url.com/media/2011/06/650026_x640_21.jpg

Thank you!

2 Answers
2

Actually … the blogs.dir part isn’t used except for internally.

Let’s say you have a network with two sites – http://url.com and http://sub.url.com. The files will be located in (respectively):

  • http://url.com/files/2011/06/...
  • http://sub.url.com/files/2011/06/...

The blogs.dir directory is where the images exist physically, yes, but your .htaccess file is routing the virtual directories I just listed above to the correct location.

I’m guessing you’re manually putting together the URLs you reference above … because that’s not how Multisite is set up to work by default.


Update

I just tested this on my own network installation to give you a specific example.

My main blog is http://mindsharestrategy.com (custom domain mapped to a subdomain network installation – http://business.eamann.com is the same site). A recent post with images: How to Publish a WordPress Plugin – Subversion.

The first image in the post is: http://mindsharestrategy.com/files/2011/05/checkout.png

But an alternate link that also works: http://eamann.com/wp-content/blogs.dir/2/files/2011/05/checkout.png

WordPress automatically maps the /files directory for this site to /wp-content/blogs.dir/2/files via the .htaccess file.

So your image permalinks will work with the shortened version … there’s nothing you need to do there. It sounds like your problem is actually with the way the shortcode outputs content.

Leave a Reply

Your email address will not be published. Required fields are marked *