1

Ubuntu 12.04, running on Apache server. I wonder if it is possible to run/access from the browser html/php file from other than the document root location let's say from folder /testfolder on the root.

So once I enter the browser example.com/testfolder It will be executed the same as from var/www/example.com/httpdocs/testfolder.

But files and this folder will be on the root in /test folder not in document root (httpdocs) I don't want to put this folder physically at all in httpdocs. The goal is to hide those files/folders from the default www vhost folder.

2 Answers 2

4

You should use a <Directory> directive and an Alias:

https://stackoverflow.com/questions/15770778/configure-apache-conf-for-alias

The directory does not have to be inside the documentroot.

5
  • But I want additional directory to be processed all files inside documentroot + custom located somewhere on disk. I used alias and Dir and not worked.
    – Rambo
    Sep 13, 2014 at 21:22
  • I'm afraid that I don't understand the question. Sep 14, 2014 at 6:59
  • I mean this is not a solution.
    – Rambo
    Sep 14, 2014 at 9:28
  • 1
    Yes, I understand that - the problem is that I don't understand your original question. You should improve it if you want me to help. Sep 14, 2014 at 19:44
  • 1
    So this should work and the example given in the linked question if correct. A couple of additional thoughts. Make sure that your <Directory> and Alias directives are in the correct block of your httpd.conf. Second make sure that the user running apache (usually apache, nobody or httpd) has read access on the folder. Finally check your logs for error message. If that doesn't help post your config so we can give you more help. Nov 20, 2015 at 1:28
2

You can do a symbolic link, bash command:

ln -s /testfolder/ /var/www/example.com/httpdocs/

or

You can do an Alias directive in your server configuration :

Alias /testfolder/ /var/www/example.com/httpdocs/testfolder/

You must log in to answer this question.

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