Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: .htaccess download pdf
PostPosted: Sun Feb 23, 2014 12:05 pm 
Offline
Senior Newbie

Joined: Sat Nov 16, 2013 11:46 am
Posts: 17
Hi,
I have a site with 2 pdf-forms. I'd like to force the browser to download them instead of opening in the browser window.
Site runs on apache with nginx proxy.

In the folder containing the 2 files I have this .htaccess:

Code:
<Files *.pdf>
  ForceType applicaton/octet-stream
  Header set Content-Disposition attachment
</Files>


the nginx virtualhostfile has
l
Code:
ocation ~* ^.+\.(htm|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|bz2|pdf|odt|txt|tar|bmp|rtf|js|swf|avi|mp4|mp3|ogg|flv)
(\?.*)?$ {
    expires 30d; #adjust to your static content's update frequency
    root /sites/public_html;
  }
  location ~ /\.ht { deny all; }
}


However, the browser keeps on opening the file instead of downloading it


Top
   
PostPosted: Sun Feb 23, 2014 2:29 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
Zip'm, then the browser doesn't have a choice but to save to disk.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Sun Feb 23, 2014 11:40 pm 
Offline
Senior Newbie

Joined: Sat Nov 16, 2013 11:46 am
Posts: 17
I know, but unzipping them is an extra step before they can be filled in , which is not user-friendly


Top
   
PostPosted: Mon Mar 17, 2014 9:29 pm 
Offline
Senior Newbie

Joined: Wed Jan 22, 2014 8:11 pm
Posts: 6
Website: http://eightyfiveconsulting.com
Location: Orange, CA
Not sure if you were able to solve this or not, but this has worked for me in the past:

http://www.nakedmcse.com/Home/tabid/39/forumid/14/postid/42/scope/posts/Default.aspx

_________________
http://eightyfiveconsulting.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group