我有用于PHP的Apache2.4 Web服务器,我想使用.htaccess确保它的安全,这样除了根文件夹(var/www/html/index.php
)中的index.php
以外,没有人能够访问我的文件.问题是,在我的配置中,它只允许从localhost/index.php
开始的index.php,而不是localhost/
.我try 重定向,但没有太大变化:
DirectoryIndex index.php
# Redirect the root (/) to index.php
RewriteEngine On
RewriteRule ^$ /index.php [L]
# Deny all requests by default
Require all denied
# Allow only access to index.php
<Files "index.php">
Require all granted
</Files>