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.

Rambo
  • 31
  • 1
  • 1
  • 5

2 Answers2

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.

Daniel Scott
  • 430
  • 3
  • 11
  • 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 '14 at 21:22
  • I'm afraid that I don't understand the question. – Daniel Scott Sep 14 '14 at 06:59
  • I mean this is not a solution. – Rambo Sep 14 '14 at 09: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. – Daniel Scott Sep 14 '14 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 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. – Catherine MacInnes Nov 20 '15 at 01: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/
Froggiz
  • 3,043
  • 1
  • 19
  • 30