Jump to content

htaccess MIME types

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
12 replies to this topic

#1
jjjaroscak

jjjaroscak

    Newbie

  • Members
  • Pip
  • 7 posts
I've been trying to learn to use htaccess files for apache and everything I find starts out with using it for authentication. The only thing I want to do with the htaccess file is add MIME types so I was wondering what all I actually needed for just that. I know AllowOverride in the httpd.conf file is set to AuthConfig.

Can anyone tell me what all I need to get it to work? Thanks!

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
What you had asked is too general to give an answer, what are you wishing to do by adding mime types?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
jjjaroscak

jjjaroscak

    Newbie

  • Members
  • Pip
  • 7 posts
I'm trying to get Microsoft 2007 documents (docx etc) to open correctly in IE

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
I am not sure, but the specs seem to point to this handler:
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
jjjaroscak

jjjaroscak

    Newbie

  • Members
  • Pip
  • 7 posts
Yes, I have what all the AddType's are supposed to be, but what I'm not sure about is what else I need in my htaccess file for it to take effect because right now it doesn't seem to be helping anything, so I guess I assume I'm missing something so that the htaccess file isn't actually loading the AddType's

#6
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
What exactly happens to you IE browser when you browse the file? It can be numerous reasons, not just that single MIME.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#7
jjjaroscak

jjjaroscak

    Newbie

  • Members
  • Pip
  • 7 posts
It tries to open them as zips since it doesn't know what the externsion means. So therefore I need the mime types. What all do I need in my htaccess file to get the mime types to load?

#8
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Maybe try adding this to /etc/mime.types file (or wherever your Apache config may be)
application/vnd.openxmlformats-officedocument.wordprocessingml.document  docx

I had looked extensively at the web and those two solutions are all I can find.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#9
jjjaroscak

jjjaroscak

    Newbie

  • Members
  • Pip
  • 7 posts
Yeah, I know this is supposed to be the solution, and I'm currently limited to only being able to edit my htaccess file. The file was completely blank, then I added the AddTypes, but it didn't do anything. My guess is I'm not doing something right, so Apache is just ignoring my htaccess file because I haven't added something that it needs.

#10
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Where are you adding the .htaccess file? You can try to put gibberish into the file and your server will spit out an HTTP 500 error to verify it is actually reading i t.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#11
jjjaroscak

jjjaroscak

    Newbie

  • Members
  • Pip
  • 7 posts
Okay, I did have the .htaccess file someplace that apparently doesn't work. Putting it into /var/www/html does.

having an htaccess with the following gives me the error "order not allowed here"
order deny,allow

<Files .htaccess>

order allow,deny

deny from all

</Files>


AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx

Having just the AddType I get the error "AddType not allowed here"

So I am guessing I'm missing something

#12
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Try adding AllowOverride FileInfo before the AddType entry, if this is not allowed then you are disallowed to do anything with your htaccess files until you change the appropriate AllowOverride option in httpd.conf for your Apache server.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.