FORUMS: list search recent posts

htaccess and mime types

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeff Mackhtaccess and mime types
by on Aug 19, 2010 at 3:10:37 pm

I have a page on godaddy and I have a lot of videos installed in flash. Now I am trying to make an IPhone compatable page and have added m4v's and mp4's but they won't play on an iPhone 3G. I was told I need to add mime types and that you do that by adding them to the .htaccess file. My site never had one. I did a little research and created one from a generator. Then I saw the lines to add the mime types so I combined them. I cut and pasted the following into a TextEdit file on my mac. Then uploaded it to my root directory and nothing happened. Can anyone tell me if this is right or how to fix it?



deny from all

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(http://www\.texasmusicchannel\.net)(:80)? [NC]
RewriteRule ^(.*) http://texasmusicchannel.net/$1 [R=301,L]
AddType audio/x-m4a MPEG-4 media m4a
AddType video/mp4 MPEG-4 media mp4
AddType video/x-m4v MPEG-4 media m4v
order deny,allow


Jeff


Return to posts index

Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 3:15:53 pm

hello...

first step is - this will only work if you are running a *nix hosting plan running apache as the webserver as opposed to a windows hosting plan...

do you know if you are running apache?

sitruc


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 3:25:37 pm

Yes.


Server IP Address: 97.74.215.192 SSL Status: Purchase SSL Certificate Operating System: Linux Hosting Type: Shared Hosting Hosting Configuration: 2.1 PHP Version: PHP 5.x MySQL Databases: 0 Setup of 25 Available Bandwidth Allotment: 1,500,000 MB Disk Space Allotment: 150,000 MB Data Center: US Regional Data Center
Search Engine Visibility: Analyze my site Primary Domain DNS: View

jeff


Return to posts index


Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 3:52:16 pm

hello...

ok - next thing is to find out if the settings for apache at godaddy allow you to override those types of things - htaccess can be configured on a server level to allow a lot or a little, and most large isps tend towards the latter to avoid having users make a mess.

(not that you are, but you get what i'm saying)

so check to see if godaddy allows you to override those settings. can you also point us to the site where you read this as a recommendation?

sitruc


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 4:25:33 pm

Just called them and they do allow mime types to be added to my site through the .htacces file. I am looking to add h.264 .mov's, mp4's and m4v's so I can view them with an iPhone. I have 3 identcal files on my site here:

http://www.texasmusicchannel.net/1.mov /1.mp4 and /1.m4v

I have the same files on my mobile me account here:

web.me.com/yasgur/1.mp4 and /1.m4v.

The files play on my mm account but not on my godaddy account. The funny thing is that on my desktop machine, the .mov plays on my godaddy account but the others give me a file not found.

Jeff


Return to posts index

Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 5:53:32 pm

hello...

from what i'm seeing, your rewrite rules aren't doing anything at all - these 2 lines:

RewriteCond %{HTTP_HOST} ^(http://www\.texasmusicchannel\.net)(:80)? [NC]
RewriteRule ^(.*) http://texasmusicchannel.net/$1 [R=301,L]

would in theory redirect any request to "http://www.texasmusicchannel.net" to the non-www "texasmusicchannel.net"...however HTTP_HOST does not include the http protocol in it, so this rewrite condition should never match. it also wouldn't help with your mime types at all, because it's just a url shuffle...

however, i notice when i go to either:

- http://www.texasmusicchannel.net
- http://texasmusicchannel.net

i automatically get redirected to:

http://texasmusicchannel.net/TMC/home.html

and there is definitely nothing in those rewrite conditions to do that, so i don't know what all you have going on there, but it would appear that what you are using on the server is not what you pasted here?

also - since i can't see your files, i have to ask the dumb question - are you sure you have the 1.mp4 and 1.m4v files on your godaddy account?

sitruc


Return to posts index


Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 8:33:11 pm

Hey Curtis,

I gues you need to disregard that htaccess file. I used an htaccess generator I found on the web and then I added the mime types to it. I totally DON'T know what I am doing with that. My godaddy account has 7 web pages hosted there. My main pafe is the texasmusicchannel site. the index page is in my root directory and the pages are directed into the TMC folder.

Here is what my root looks like:

So, the bottom line, the mp4 and the m4v won't play. The .mov plays on my desktop but not on the phone. I just don't know what to do and GODADDY won't help me.

Jeff


Return to posts index

Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 8:41:25 pm

hello...

ok - so do you know how you have the redirect setup to the TMC sub dir? is that in an htaccess file or in code somewhere as a meta or the likes?

that could be part of your problem, but w/o being able to see everything, it's hard to debug...

wrt the movies - to go back to the start, do you want to:

a) automatically redirect any request to 1.mov to 1.m4v if the user is visiting on an iphone or an ipad?

b) redirect any request from an ipad or iphone to a sub dir that has these videos?

best way to temporarily disable the htaccess there now is to just rename it to ".htaccess_OFF" or the likes and then it won't kick in and you can see where the TMC redirect is happening...

(and i've heard that godaddy doesn't honor these changes for a few minutes, which honestly makes no sense, but at a minimum you'll need to clear your cache when reloading the site)

sitruc


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 8:59:19 pm

the redirect is in code in my index file. I will delete the htaccess as it was something I made with my head up my ass.

As far as the movies, the only reason they are in the root is because it was easy to test them there. I will delete those when this gets working.

My first thought was to create this page: http://texasmusicchannel.net/TMC/the_os_City_1-29-10_Iphone.html

These are h.264's that are hyperlinked to the files. They play on the 3GS and a 4G but not on a 3G. This is what started my whole problem. So I started to think an mp4 or an m4v would work better.

So I actually created a page (which is now gone) that had a gallery of mp4's and m4v's but they wouldn't work at all.

GoDaddy totally will not help me and on another forum, someone suggested I add mim types. The only way to do that is to add an htaccess file.

So now I am thoroughly confused.

Jeff


Return to posts index


Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 9:07:05 pm

hello...

don't delete stuff yet - i realize we're still testing...

so i guess i'm still not clear on what you want (regardless of what you've tried to this point)...let's say for the sake of discussion that 1.mov is right where you want it, and you have 1.m4v and 1.mp4 there as well.

if you embed the movie in a page, you won't be able to show one version for iphone/ipad and another for others just by doing htaccess stuff. if, on the other hand, you are giving the link directly to somebody (i.e. http://foo.com/1.mov), then you can redirect browsers that go to that url based on the http host and get them to the right file for their platform...

so it sounds like you'd rather go for option (b) from my original choices, which is to have an iphone user get redirected to a special portion of your site if they go to a like non-iphone portion. so for example, let's say you have:

http://foo.com/videos/index.html

and you want to have iphone visitors see a special iphone version automatically. you can use rewrite rules to automatically have them go to:

http://foo.com/videos/index_iphones.html

is that a desired goal here? if so, i can set up an example for you on another server that you could look at, or you can google up the answer to that one...

if not, let me know what you want to do ultimately (not really what you've tried) so that i can best help you figure out how to achieve that goal...

sitruc


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 9:45:35 pm

I think this will give you the idea of what I am trying to do.

http://web.me.com/yasgur/Dallas_FCPUG/Dallas_FCPUG_Blog/Dallas_FCPUG_Blog.h...

This is a page hosted on my mobile me account. As you see on the home page, there is an iPhone for users to click to see the videos on their phone. The home page utilizes a flash playlist for desktop services. Now, how can I send this page to GoDaddy and play those files on my godaddy account?

Jeff


Return to posts index

Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 9:53:31 pm

hello...

ok - try this then:

- back up and remove the current .htaccess file in the web root
- take the meta type portion of that file and create a new .htaccess in the /TMC directory - so just this part:

AddType audio/x-m4a MPEG-4 media m4a
AddType video/mp4 MPEG-4 media mp4
AddType video/x-m4v MPEG-4 media m4v

then build your pages as you normally would - maybe just do a test page with your 3 videos to see how that works first...

i can't explain why you get a 404 file not found on the 2 non-.mov copies of the movie in the site root, but since i can't see all your web code, it's impossible to say (they could have the wrong permissions and a web user can't even see them, for example) - but try the above and see how it goes. you shouldn't need any of the rewrite condition rules or the deny/allow snippets in the new .htaccess file

(alternately you can probably just leave the htaccess file in the root if you want and remove the stuff mentioned here - 6 of one, half dozen of the other, really)

sitruc


Return to posts index


Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 9:57:58 pm

So should there only be those 3 lines in a text file, and then upload it to the /TMC folder - nothing in the root account?

Jeff


Return to posts index

Curtis ThompsonRe: htaccess and mime types
by on Aug 19, 2010 at 10:05:36 pm

ya just those 3 lines - htaccess works on any content that is at its level or beneath it, so if you put it in the root, it will cover the tmc dir, but sometimes if an entire site is in a subdir, i just put the htaccess there so that i can keep track of it...

then build your iphone-specific pages with links to the m4v movies and it should work out ok (again sticking my head in the sand wrt the 404 on the current files as i don't have enough exposure to say why that is happening, but it's not related to htaccess mime types)


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 19, 2010 at 10:11:57 pm

k, I'll try this and report back.

Jeff


Return to posts index


Jeff MackRe: htaccess and mime types
by on Aug 20, 2010 at 12:32:51 am

No luck Curtis, Here's the test page: http://www.texasmusicchannel.net/TMC/Site/Blank.html

I put 3 hyperlinks on the page to the three files. Click a red square. The .mov plays on the desktop but not he iPhone 3G. The other two are file not found.

Jeff


Return to posts index

Curtis ThompsonRe: htaccess and mime types
by on Aug 20, 2010 at 2:11:21 am

hello...

the 404 error is vexing. if you remove the htaccess file and try again (remember to perhaps wait and also clear cache), do the links to the other 2 movies then work?

also - i'm not 100% up on adding my mime types via htaccess, but it does seem like you have a bit of extraneous info there - have you tried a simpler set like this:

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

so i'd say:

1. try to disable the htaccess file and see if you can at least then see the movies via the links

2. if you cannot see them still, then i'm really lost and it could be something related to godaddy somehow. if you can see them via the links at that point, then try the simpler addtype calls above and see if those work (so replace yours with those and reinstate the htaccess file)

sitruc


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 20, 2010 at 3:05:24 pm

Curtis, I worked my ass off last night on this and think I have found the problem. It came down to two issues. First, the page not found errors were due to the mime types. I tried to play files without the htaccess and got th page not found. I then added the htaccess and I got the file that wouldn't play. This was the second problem. Evidently my h264 files were encoded with a quicktime format versus the mpg format. My m4v's are now working on my iphone. I am rendering a h.264 with an mpg format which will produce an mp4. I am pretty sure that will work when it is done and I will report back.

When I encoded hundreds of videos, I encoded them to h264's with a quicktime format. I am trying to figure out that mime type to see if I can utilize those files. If nothing else from now on, I can produce 1 encode and utilize it twice, once in a flash playlist and one as a stand alone file.

Thanks for all of your help!

Jeff


Return to posts index

Jeff MackRe: htaccess and mime types
by on Aug 20, 2010 at 8:27:35 pm

Curtis,

I got it all figured out. Here is a test page. http://www.texasmusicchannel.net/Test2/Blank.html

There is a flash playlist with all three types of files. They play great on my desktop. Then at the bottom of the page is test 2 and test three. Test two has my videos in a video gallery on my mobile me account and test three has videos in a video gallery on my go daddy sight.

All of the videos were reencoded using mpeg as the format vs. quicktime.

Now, if I could only find out how to get the quicktime formats to play on the sight, I wouldn't have to re-encode hundreds of videos.

I can't thank you enough for helping me yesterday.

Jeff


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]