I am running wordpress 3.2rc2 multisite.

I inserted a few .mp4 videos into the root of my domain so that I can run a few basic tests with the jw player.

When I try to access the url to the .mp4 video, I somehow end up with a wordpress 404 page. This is also causing errors within the jw player saying that either the file is not found, or access is denied. Permissions are 644 on the mp4 files, and the owner/group is correct.

Why is this happening and how do I fix it so that wordpress stops messing with my mp4 files?

Also: can someone please add the mp4 tag, I don't have enough rep to do this yet.

Here is my htaccess file:

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).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

AddType video/ogg  .ogv
AddType video/mp4  .mp4
AddType video/webm .webm

Edit If I use the wordpress media uploader, then I can access the mp4 videos just fine. I just can't place them anywhere else on the server which is a problem.

Anyone have any further ideas as to why wordpress is screwing with my mp4s when in other directories or even when they are in the root?

  • You have a rewrite rule: # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] What is this for? Can't this be the root of your error? – petermolnar Jul 1 '11 at 12:58
  • @cadeyrn It's a WordPress MultiSite symlink-like rule for uploaded files. – TheDeadMedic Jul 1 '11 at 13:39
  • mea culpa, I should have searched for it before asking stupid questions :) – petermolnar Aug 19 '11 at 8:10

A missing mime type should not cause a 404 page but the AddType needs to be wrapped in <IfModule mod_mime.c> tags.

<IfModule mod_mime.c>
    AddType video/mp4 .mp4 .m4v
    AddType video/mpeg .mpeg .mpg .mpe
    AddType video/asf .asf .asx .wax .wmv .wmx
    AddType video/avi .avi
    AddType video/quicktime .mov .qt
    AddType audio/ogg .ogg

I'm running jw player on a multisite and I had to use absolute urls to access the player and the file. I created a folder in my site root that contained the player and files then wrote a function to display the video and enqueued the swfobject using wp_enqueue_script.

 add_action( 'template_redirect', 'load_swf_object' );
 function load_swf_object() {
    wp_enqueue_script('swf_object', '/jw/swfobject.js');

function c3m_play_the_video() {  
 echo "<div id='front-vid'>
        <div id='videospace'>This text will be replaced</div>
        <script type='text/javascript'>
      var so = new SWFObject('http://example.com/jw/player.swf','mpl','520','350','9');
| improve this answer | |
  • I do not have a problem accessing the player itself. It is just that when I click play it says the video is not found. So to check the problem, I simply type the full url to the video in the browser. This produces a wordpress 404 page, which means the player will never see it. – shawn Jul 1 '11 at 18:07
  • Are you able to access other files in the root directory? – Chris_O Jul 1 '11 at 21:52
  • Yes, I can access some files like .html files in the root dir – shawn Jul 2 '11 at 7:05

Do you have the correct capitalization for the filename?

These rules basically say that if the file exists, serve it instead of going on to the WordPress rules:

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

That says if the requested file is a file that exists or if it's a directory that exists, then do no rewrite, and stop processing ([L] = Last rule).

So you must have the filename wrong in some fashion, because if the file existed with the given name, then this rule forces it to serve it up properly.

| improve this answer | |
  • Absolutely positive that I have the correct filename: example: live.wptumble.com/06-26-2011-short3.mp4 double/triple checked it. – shawn Jul 2 '11 at 22:43
  • Well, I can't see anything wrong with those rules. Try temporarily disabling them, see if that makes any difference. Then try disabling them in sections, figure out what rule is causing the issue. The major point to take home here is that you shouldn't be getting redirected into WP at all if the file actually exists, so this is outside of WP's scope and in those rewrite rules in some manner. Existing files are supposed to get served directly, not through WordPress. – Otto Jul 3 '11 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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