how to make force download in centos nginx dedicated server

Started on the old forum in December 2016 · view the original in the archive · old links redirect here

1 reply · 70 views · started 9 years ago · 1 min read

2 participants
dj-coder Junior · 41 posts #1

hello dear coding talk members.

i am looking for a simple code which make media files force download in all browser i don't want it to do with php header if anybody know how to do this with nginx please do share here your code not here is example where is my media files please read below.

path of my web page url : /home/wwwroot/domain.com = this is my website contents hosted path on my dedicated server path of my media files: /home/wwwroot/domain.com/files = this is my media files storage path

i want you to please make a code for files dir so if any user will access this url with 200 file response so make that force download in client browser or system what else user using please make a single code for all browsers.

Thanks in advance....

wapxtech Developer · 189 posts #2

in your files directory add .htaccess containing

<FilesMatch "\.(?i:jpg|gif|png|mp4|3gp|avi|mpg|mpeg)$">
  Header set Content-Disposition attachment
</FilesMatch>

External image (may be gone) http://wapx.amob.com Applications, Games, Wallpapers, Ringtones, Videos, Themes, Screensaver and More!!!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close