0

What I have to write to the .htaccess file so that the visitors will be able to download .docx files?

ilhan
  • 288
  • 5
  • 15
  • So much more information required. Like why you think they can't download them now. – womble Dec 19 '09 at 01:44
  • I have added AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx to the .htaccess file, didn't worked and application/vnd.openxmlformats-officedocument.wordprocessingml.document docx to the mime.types under etc/ and etc/mydomain.com, did't worked. – ilhan Dec 19 '09 at 02:26
  • It works by this way: Run socalledoriginal.docx file as php (AddType application/x-httpd-php .docx) – ilhan Dec 19 '09 at 03:34

3 Answers3

2

Sounds like a browser configuration problem. Make sure your browser is configured to download files of the appropriate content type rather than trying to display them.

Also, you could try adding the Content-Disposition header, which can be done with the Header directive in Apache: http://httpd.apache.org/docs/2.2/mod/mod_headers.html#header Here's one explanation of how to use the header: http://support.microsoft.com/kb/260519

David Z
  • 5,475
  • 2
  • 25
  • 22
2

Are your docx files trying to be run as zip files from the client? Since Office2007 files are essentially just xml files zipped together, Unix treats them like regular zip files, due to their magic numbers. And thus Apache sends the wrong MIME type headers.

A rather succinct answer for this can be found in another serverfault question: Why are docx, xlsx, pptx downloading from webserver as zip files?

Christopher Karel
  • 6,582
  • 1
  • 28
  • 34
1

This is an IE problem, but easy to solve in the .htaccess:

 <FilesMatch "\.(?i:docm|docx|xlsx|xlsm|xlsb|pptx|pptm|ppsx)$">
  Header set Pragma private
</FilesMatch>

Make sure you don't use SSL (https) or iE gives an error