如何在apache下的documentroot下创build别名

我正在尝试创build一个bin文件夹,可访问文档根目录下的virutalhost。

我目前通过mysite.local / bin访问该文件夹,但需要文件在公共访问下。

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> 

理论上文件树应该读取

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

这样的url文件:mysite.com实际path:mysite.com/html/index.php可以读取这样的内容:

 <?php include "../bin/privatefile.php"; ?> 

我不太了解你的问题,但以下信息可能会有所帮助。

如果您正在尝试为虚拟主机configuration目录,则应该将该configuration放在<VirtualHost>指令中,而不是放在httpd.conf中。

您的<Directory>指令是不正确的: <Directory>需要一个目录path参数。 您提供了一个url-path参数,这个参数适用于<Location>指令。 <Directory><Location>非常相似,主要区别在于参数是目录path还是urlpath。

文件“将URL映射到文件系统位置”也可能是有帮助的。


在你所示的目录树中, bin/ html/ 上面 ,而不是在下面。

你根本不需要别名或者号码簿指令。 PHP include指令中的path是文件系统path,而不是URLpath。 我只是testing它来validation,因为我不是很stream利的PHP。