#使用NameVirtualHost 来配置基于DNS的虚拟主机的配置
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@1717pk.com
DocumentRoot "G:\1717pk.com\home"
ServerName "my.1717pk.com"
DirectoryIndex index.php index.html index.htm default.php
<Directory "G:\1717pk.com\home">
Options Indexes FollowSymLinks #---------->Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/(space|network)\-(.+)\.html$ /$1.php?rewrite=$2 [L]
RewriteRule ^(.*)/(space|network)\.html$ /$1.php [L]
RewriteRule ^(.*)/([0-9]+)$ /space.php?uid=$1 [L]
</IfModule>
</VirtualHost>
要禁止 Apache 显示目录结构列表,只需将 Option 中的 Indexes 去掉即可。
你只需要将上面红色代码中的 Indexes 去掉,就可以禁止 Apache 显示该目录结构。用户就不会看到该目录下的文件和子目录列表了。
Indexes 的作用就是当该目录下没有 index.html 文件时,就显示目录结构,去掉 Indexes,Apache 就不会显示该目录的列表了。