I'm running httpd on linux.

I have a folder (/data/) that is not in the apache web directory (/var/www/html/) that I would like users to be able to access from their browser. I don't want to move this folder.

How do I make files in this folder accessible to a web browser when the folder is outside the apache web folder?

4 Answers 4


You can use mod_alias to do this quite simply

Alias /data /data/outside/documentroot
<Directory /data/outside/documentroot>
     Order allow,deny
     Allow from all

Would redirect urls like http://example.com/data/file1.dat to the file /data/outside/documentroot/file1.dat

  • 3
    e.g. put that in new file /etc/httpd/conf.d/dir_data.conf and 'sudo service httpd reload' for redhat flavoured linuxes.
    – gaoithe
    Aug 3, 2016 at 9:01
  • This doesn't allow you to list the directory.
    – Cerin
    Apr 4, 2019 at 18:06
  • I had to add "Require all granted" to the block for this to work
    – Jason
    Apr 21 at 5:20

You want Alias.


I used a symlink to pull this off. I'm wondering if there are any implications of doing this that I should be aware of.

ln -s /data/ /var/www/html/
  • 2
    Now you have to enable symlinks on your server, which means that other files on the system could be accessed/compromised if symlinks are able to be created somehow. Jul 31, 2011 at 9:21
  • 2
    This means you've the FollowSymlinks directive enabled in your configuration; which means external users could access stuff outside the directories you wanted to publish. This can be a problem or not; in general, you want to be sure no symlink is around which could expose data you didn't want to expose in the first place. Jul 31, 2011 at 9:23

I also used symlink with a name like this:

ln -s /data/ /var/www/html/data

Then go to the URL: http://your_server_ip/data

  • In an environment remotely concerned with security this will not work.
    – chicks
    Mar 28, 2017 at 15:04
  • I second @chicks - if the server is correctly configured, this really shouldn't work. If it does work, you have some serious security issues.
    – Jenny D
    Mar 29, 2017 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .