.htaccess = No Alien Jarble for Video Links

Ever click a video link only to have a page open featuring miles of jarbled alien talk? Don’t let that happen on your site.

Apple XCODE developer Jason Molenda was kind enough to send me this wonderful tip via email.

If you’d like to ensure that no one ever sees said jarbled alien when trying to view your videos, open a text editor and save a file WITH NO EXTENSION called “.htaccess” (.htaccess is the extension). In said text file, copy and paste the following:

AddType video/x-m4v .m4v
AddType video/x-mp4 .mp4
AddType audio/x-m4a .m4a

(where you can see how easy it is to add file extensions in question: the three listed here are what I’ve found to be the most common problems for me).

Since many browsers (including Safari and Firefox) don’t “understand” the .mp4 or .m4v extension unless you right click and choose “download linked file as”, the .htaccess file will allow web browsers to “package” the above file extensions as complete files (ie: displaying the video file in a blank page), and there’s actually a lot more functionality you can add with .htaccess files such as disabling directory browsing and setting passwords.

After saving the file, upload it to your webserver while keeping in mind that this file will “help” every video file not only the directory you loaded it to, but also subdirectories beneath it.

For example: loading said .htaccess file to the yourcoolwebsite.com/ ROOT directory will also affect videos in yourcoolwebsite.com/short_films (which is a good thing if you’d like to globally affect all the videos on your site).

For more info on .htaccess, click here.

A very big thanks to JODOTCOM reader Jason Molenda for sending in that tip! You rule, brother!

And if you’re looking for a good OS X FTP Client, I’d recommend Transmit.

2 Comments »

  1. Anthony wrote,

    It would be good to check if your web server is allowing use of .htaccess files. It’s fairly common, but not a sure-thing.

    Comment on June 9, 2006 @ 9:52 am

  2. Josh Oakhurst wrote,

    Anthony is right.

    Most good hosting companies worth their salt user server technology allowing .htaccess files - but you should check with your hosting admin first.

    Comment on June 10, 2006 @ 3:33 am

Leave a comment

RSS feed for comments on this post. TrackBack URI