how to make force download in centos nginx dedicated server

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to make force download in centos nginx dedicated server

    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....





  • #2
    in your files directory add .htaccess containing
    Code:
    <FilesMatch "\.(?i:jpg|gif|png|mp4|3gp|avi|mpg|mpeg)$">
      Header set Content-Disposition attachment
    </FilesMatch>

    Comment

    Working...
    X