Search code examples
apache

Can you make a file downloadable through Apache?


Path = /var/lib/foo.txt

Is it possible to configure Apache so there would be some HTTP URL that would initiate a download of this file and how? Without .htaccess file.

And what would that URL be then? localhost/var/lib/foo.txt?


Solution

  • It's as simple as adding an alias directive within your apache config.

    Alias '/bar' '/path/to/foo'
    

    Then you'd access the resource publicly via something like http://example.com/bar.