XAMP多站点配置

#wamper+基础配置  NameVirtualHost *:80不要忘了加
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "d:/phpenv/apache/htdocs"
</VirtualHost>

<VirtualHost *:80>
    ServerName ams.com
    DocumentRoot "D:/wamp/www/ams"
        <Directory "D:/wamp/www/ams">
        Options Indexes
        Allow from all
        Allowoverride all
        DirectoryIndex index.php index.html default.html default.htm
    </Directory>
</VirtualHost>

 

-----------

NameVirtualHost *:80

#############配置一
<VirtualHost *:80>
ServerName psj.com
DocumentRoot "D:/xammpp/htdocs/psj"
<Directory "D:/xammpp/htdocs/psj">
#Options Indexes     dede网站搬家后的配置
Order allow,deny
Allow from all
Allowoverride all
#
DirectoryIndex index.php index.html default.html default.htm

</Directory>
</VirtualHost>

#############配置二

<VirtualHost *:80>
ServerName lj.com
DocumentRoot "D:/xammpp/htdocs/lj"
<Directory "D:/xammpp/htdocs/lj">
Options Indexes
Allow from all
Allowoverride all
#
DirectoryIndex index.php index.html default.html default.htm

</Directory>
</VirtualHost>

 ----------------------------------------------------------------------------------------------------------------

前提条件  httpd.conf 

AllowOverride None

改为

AllowOverride All

 

 .htaccess禁止访问某个目录下的文件

将以下保存为.htaccess并复制到目录下即可

<Files ~ ".*">

Order allow,deny

Deny from all

</Files>

-----

如果只禁止访问如栏目下的index.html文件

可以这样设置

<Files ~ "index.html">   #~表示任何文件类型

Order allow,deny

Deny from all

</Files>

 ----------------------

http.conf的配置

 

Order Allow,Deny 规则详解

Order Allow,Deny 检查下面2个规则的顺序
Allow from all
Deny from ip1 ip2

Order Allow,Deny 下面2个规则的顺序是错误的
Deny from ip1 ip2
Allow from all