我有.htaccess文件:
Order deny,allow
Deny from all
# deny view files in directory
Options -Indexes
<FilesMatch "index.php|profile.php|newgame.php|game.php">
Allow from all
</FilesMatch>
它运行良好,我可以像site.com/index.php
这样的URL打开index.php
或profile.php
。但是我无法为URL site.com
打开网站。为什么?我可以访问index.php
。site.com
不是site.com/index.php
。如何更改.htaccess文件以考虑到这种情况?
更新
apache2.conf包含:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
您需要配置apache以识别index.php为索引文件。
添加
DirectoryIndex index.php