和apache tomcat一样,我想从url栏中删除文件夹导航。
我在我的php服务器(xampp)中有这个目录结构
localhost/allsites/site1/public/index.php
我想通过ip
访问相同的urllocalhost
这样,我就可以像访问http://localhost
一样访问http://localhost/allsites/site1/public/
文件夹中的所有文件。如果任何其他文件夹内,它仍将是相同的,可以访问,http://localhost/admin
我该怎么做呢?
您需要在httpd-vhosts.conf中像下面这样设置
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "E:/xampp/htdocs/allsites/site1/public/"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
注意:该文件在xampp'apache'conf'extra和yes在文档根使用您的xampp文件夹路径