video files fail with iOs / ipad / mac / iphone - fix wp-includes/ms-files.php?file=$2 changes?? (h

Ran into a problem with ios devices playing mp4 videos via a multi-site networked site with buddypress and rtmedia with fmmpeg converter..

host tells me it’s likely related to this code:

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

This multi site was started prior to 2010
(network was created before June 2010 (version 2.9.2 or below).)
– and I notice on the wp codex that there is no mention of these rules in the picture showing the htaccess that is created with current ms installs.. but looking at the old / previous pics int he codex wiki thing it does show.

as the files play fine when going directly to the url, but not fine with viewed through wordpress which is being affected by the htaccess I guess.

So.. main thing is how do I fix this not affecting the files in folders like
http:// ourdomain

of course I also wonder if this htaccess code should just be removed – or if removing it would cause problems for older files that were uploaded and linked to – not really sure what the code does.

any thoughts on fixing this issue without breaking everything old?
my managed hosting people have confirmed that the videos work with windows desktop and some android - but not iOs devices, when viewed on site, eg:
(nsfw -(dont go to the url if naked people parts would offend you or anyone near you!) )

this was setup as subdomain not sub folder

help appreciated,


  • Dimitris

    Hey there djsteve,

    hope you're doing good and thanks for reaching us! :slight_smile:

    As you can also see here
    you must be using the oldest WP htaccess version, back in times where multisite was coming through a plugin. Unfortunately, if you change this snippet then your other media files won't be accessible so I doubt that this could be a workaround here.

    As I don't own an iOS device, could you please elaborate a bit more with me about these issues?
    Is it that they are not playable at all? Do they produce any error messages? Please advise!

    Are you using any other player or is this the default HTML5 player?

    Could you please grant us with support access to your website to further inspect your WP admin setup? You can do so via WPMUDEV dashboard plugin as described here

    Warm regards,

  • Dimitris

    Hey there djsteve,

    how are you today?

    I think this is an issue due to the rtMedia FFMPEG Addon most probably.
    I noticed the following errors in your website while I was using Safari browser.

    Then I tried to replicate this only with BuddyPress and free rtMedia plugin, with no avail though!
    Safari was playing my "testing.mp4" uploaded video correctly.

    Could you please perform a theme/plugin conflict test? This should point it down accurately!
    You can leave BuddyPress and free rtMedia plugins active at all times and test the remaining ones and your active theme.

    Let me know about your results on this!
    Warm regards,

  • djsteve

    dimitris - thank you for this information, I will look into this css error you detected - there have been many modifications with this setup, many plugins, and many with the theme as well, some added manually by the rtmedia crew - I will try to hunt down the issue.

    unfortunetly I really think this has to do with the old htaccess code more than anything - as others have used the ffmpeg addon with newer wp sites without issue - so it's more of a multi-site thing,
    and likely becuase of the old htaccess code in my multi-site - which many won't have in a MS setup created today, or in the past couple of years from what I understand.

    with your test setup, did you add this code to your htaccess file and see if it still works? :

    #Header set Accept-Ranges bytes
    order allow,deny
    deny from 79.35.
    deny from 	95.250.
    allow from all 
    <IfModule mod_expires.c>
    # Enable expirations
    ExpiresActive On
    # passwqord login
    # ErrorDocument 401 "Unauthorized Access - new extra security - two step login - If you are human - username is: yes. If you agree to our terms of service - the password is: yes."
    # ErrorDocument 403 "Forbidden"
    # <FilesMatch "wp-login.php">
    # AuthName "Authorized Only - If you are human - username is: yes. If you agree to our terms of service - the password is: yes."
    # AuthType Basic
    # AuthUserFile /home/flasgcom/.wpaoslogin
    # require valid-user
    # </FilesMatch>
    # Default directive
    # My favicon
    ExpiresByType image/x-icon "access plus 1 month”
    # Images
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    # CSS
    ExpiresByType text/css "access 1 week”
    # Javascript
    ExpiresByType application/javascript "access plus 1 week"
    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    RewriteEngine On
    RewriteBase /
    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    #AddType video/mp4 .mp4 .m4v
    #AddType video/ogg .ogv
    #AddType video/webm .webm
  • Dimitris

    Hey there djsteve,

    hope you're doing good today! :slight_smile:

    I just tried to replace the .htaccess file of my test environment with the one you've kindly provided but I was still able to play mp4 videos in Safari in Mac.

    Additionally, I was able to replicate the errors in console that I shared in my previous screenshot so those errors shouldn't be considered responsible for your issue.

    The conflict test is the one which should reveal the source of this glitch.

    As I understand that this could be really tricky due to the high number of plugins and customizations, you may have to create a staging environment, meaning an exact copy of your website to another location/folder into the same server that could be used for testing without messing with the production site. You'd better advise your hosting provider about this first, as they may help you build this or even provide some kind of tool that automates this procedure.

    Warm regards,

  • djsteve

    dimitris - thanks for messing with this. I will see about doing a test system - this web site is hguge - just the database copy will likely take hours.. hmmm.

    to match our system, perhaps if you used the same htaccess - and then uploaded a video file - and then tried to play it with ipad or iphone and see if it works?

    not sure if it's related to uploads or what.

    but I do know videos on our site won't play on iphone / ipad when viewed trhough the wordpress front end.. (if you know the exact location on the server you can put that in the url via ipad and it does work - so playing the file directly works, but not via wordpress)- but if this htaccess code is commendted out: #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

    then they will play fine..

    I will research how many gb this thing is and see what I can do.

  • Dimitris

    Hey there djsteve,

    hope you're doing good today! :slight_smile:

    I re-tested that, this time I was using your .htaccess rules (apart from those considering expiration and compression) even during uploading another test video from frontend and I'm still able to view my new video in Safari in Mac (your current issue is visible in my Safari browser, so this is enough for testing now).

    Please proceed with the staging environment creation and let me know about your results!
    Take care,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.