为什么我不能像 site.com 这样的网址打开网站,尽管我在 .htaccess 文件中提供了索引.php的访问权限?



我有.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.phpprofile.php。但是我无法为URL site.com打开网站。为什么?我可以访问index.phpsite.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

最新更新