我在一个目录中有多个html文件,例如home.html,welcomec.html,login.html和index.html。
从浏览器中,我可以直接访问https://localhost/demo/welcome.html和https://localhost/demo/login.html之类的所有文件。如何防止这种情况?
我只希望从浏览器访问index.html,并允许从index.html进行另一个html访问。
您可以允许index.html并使用下面的/var/www/html
位置标记禁用所有文件:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
<Files "index.html">
Require all granted
</Files>
</Directory>
Refer link for more information
我不确定它是否允许通过index.html访问文件。您可以测试上述配置。