You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rick Gates <ri...@gmail.com> on 2011/01/26 20:33:09 UTC

[users@httpd] How to inform apache that a particular text file needs to be downloaded instead of showing on browser itself

Hi all,

This is my first post on this list.

I am currently facing an issue with apache server on my linux box.

I have configured apache along with ViewVC for browsing my CVS repository.
Everything works fine except that , whenevr I click on the download button
(in viewVC), instead of downloading, it displays the file on the browser.

To simulate the issue in a simpler manner, I just added a link on my home
page of the server which points to a text file.
I want that whenever that link is clicked, the browser downloads the file
instead of displaying it on the web browser.

Can any one tell me how can this be achieved? does it require a
reconfiguration of apache server.
If yes, then what is the conf file parameter that needs to be modified?

Thanks in advance!!
Regards,
Rick

Re: [users@httpd] How to inform apache that a particular text file needs to be downloaded instead of showing on browser itself

Posted by Andrew Punch <an...@247realmedia.com>.
Hi,

You can configure apache to send back a content-disposition header for
your file.

e.g. Content-Disposition: attachment; filename=fname.ext


Set an environment variable based on the filename (see SetEnvIf in the
mod_setenvif module) and send the above content-disposition header using
mod_headers if it matches the appropriate pattern.

I would have thought that viewVC would send back those headers itself -
apparently not.

-Andrew

On Wed, 2011-01-26 at 19:33 +0000, Rick Gates wrote:
> Hi all,
> 
> 
> 
> This is my first post on this list.
> 
> 
> I am currently facing an issue with apache server on my linux box.
> 
> 
> I have configured apache along with ViewVC for browsing my CVS
> repository.
> Everything works fine except that , whenevr I click on the download
> button (in viewVC), instead of downloading, it displays the file on
> the browser.
> 
> 
> To simulate the issue in a simpler manner, I just added a link on my
> home page of the server which points to a text file.
> I want that whenever that link is clicked, the browser downloads the
> file instead of displaying it on the web browser.
> 
> 
> Can any one tell me how can this be achieved? does it require a
> reconfiguration of apache server.
> If yes, then what is the conf file parameter that needs to be
> modified?
> 
> 
> Thanks in advance!!
> Regards,
> Rick