Podcasting on a WordPress Multisite Not Working

For the longest time I could not figure out while our iTunes would not work with our new mulitsite WordPress website. We are using the Blubrry PowerPress WordPress plugin, and for some reason, MP3 files hosted on our site would not play on an iOS device. I kept thinking it was an Apple issue and that the “next release” would fix it, but it never did.

After a year of off and on trouble shooting, the WordPress gurus from MainSteet figured it out. It is an elegant solution too…we didn’t have to change any of our internal workflow. I was literally jumping up and down when the first podcast came through successfully on my iPhone!

This is WAY over my head technically, but I wanted to post the problem and the workaround in case anyone else out there in WordPress land is having the same issues.

——————————-

The problem is that iTunes, since May of 2012, has required that any files being passed to it be configured to do byte streaming in small chunks. The server, as most are these days, is setup to accommodate for byte requests, but WordPress Multisite has a twist to the way it handles files. See, each site in wordpress places it’s files in a folder like domain.com/wp-content/blogs.dir/files/2012/06/file.txt, but to keep the world from seeing that it’s a multisite of WordPress and make it appear more like a normal site, it hides this by just linking to domain.com/files/2012/06/file.txt

The way WP does this is by passing all requests for /files to a php program that then parses it out to grab the right file from the folder of the blog that is running under that domain. BUT, and this is the problem, that program called ms-files.php, doesn’t support byte requests. So when the newest version of iTunes came out and they decided to be picky and not allow downloads that were not supporting byte requests, all downloads from itunes were freezing up.

In the future as this becomes a more known issue, I imagine that ms-files.php could be fixed to handle byte loading because php can handle byte loading, but this would require hacking into WP core to fix it and would eat a lot of time, so I found a quicker work around.

The first option requires no coding to fix, but leaves more work to the user. When you upload a podcast and insert it into the media area for blubrry, you can simply replace your URL where it says /files/ to the real url of /wp-content/blogs.dir/17/files/ Where 17 = to the blog ID number, which can be found in the site admin dashboard links to each site’s settings.

But that would require all your previous content be modified too, and it’s a hassle to your users, so I found a work around to that. Since we know which sites are doing podcasts we can wright dynamic redirects for apache in the .htaccess file. Here is what I came up with for your site.

————————————–.htaccess file————————————–
# uploaded files
RewriteCond %{HTTP_HOST} !^sermons\.trinityonline\.org
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{HTTP_HOST} ^sermons\.trinityonline\.org
RewriteRule ^files/(.+) http://sermons.trinityonline.org/wp-content/blogs.dir/25/files/$1 [L]

———————————————————————————————–

So it pretty much redirects anything that is not on host sermons.trinityonline.org to ms-files.php and if it is on sermons.trinityonline.org we redirect it to the proper (real) url so the server can do the byte request handling. This request redirect happens so last second that most users wouldn’t even notice that the URL they requested had changed and it means that you don’t have to change your process any internally.

Adam White
User Interface Designer
Main Street Enterprises
awhite@mainstreetnet.com

Advertisements

2 thoughts on “Podcasting on a WordPress Multisite Not Working

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s