Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to create a bin folder accessible to a virutalhost beneath the document root.

I currently access the folder through mysite.local/bin, but need the files to be beneath public access.

httpd.conf

Alias /bin/ "C:/wamp/www/bin/"

<Directory "bin">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>

vhost.conf

<VirtualHost *:80>
  ServerName   mysite.local
  DocumentRoot "c:/wamp/www/mysite.com/html"
</VirtualHost>

Theoretically the file tree should read

/mysite.com
    /html <-- where mysite.com reads from
    /bin
    /other private folders

That way the file in url: mysite.com actual path: mysite.com/html/index.php could read something like this:

<?php include "../bin/privatefile.php"; ?>
share|improve this question

marked as duplicate by HopelessN00b Feb 25 at 7:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 1 down vote accepted

I don't quite understand your question, but the following information may help.

If you are trying to configure the directory for the virtual host, then you should put that configuration inside the <VirtualHost> directive, not in httpd.conf.

Your <Directory> directive is incorrect: <Directory> takes a directory-path parameter. You supplied a url-path parameter, which would be suitable for a <Location> directive. <Directory> and <Location> are very similar with the main difference being whether the argument is a directory path or a url path.

The document "Mapping URLs to Filesystem Locations" may also prove helpful.


In the directory tree you diagrammed, bin/ is above html/, not below.

You do not need the Alias or the Directory directives at all. The path in the PHP include directive is a filesystem path, not a URL path. I just tested it to verify since I'm not that fluent in PHP.

share|improve this answer
    
I believe you're on the right track and that's where I am currently at. I updated the post to reflect the file tree. –  Matthew Sprankle Aug 8 '12 at 19:33
    
I updated my answer to correspond to the new information in your question. –  dsh Aug 9 '12 at 1:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.