我在 apache 中的文件夹有问题,一些文件夹正确显示 html 代码,但其他一些文件夹向我显示代码,我不想看到代码,我在该文件夹中创建的任何文件都会向我显示代码,正如您在下一个示例中所见:
https://www.midominio.net/rsarchivos/gabriel.html
在任何其他文件夹中我都可以看到正确的代码,例如:
https://www.midominio.net/admin/gabriel.html
它是唯一的 html 代码,您可以在这段代码中看到:
<!DOCTYPE html>
<html>
<head>
<title>
Hola Mundo
</title>
</head>
<body>
<p>Hola Mundo</p>
</body>
</html>
在此文件或任何其他标记中没有调用其他库。有什么建议可以解决这个问题吗?
最佳答案
检查 apache 虚拟主机或主要配置:
/etc/apache2/sites-enabled/000-default
<Directory /var/www/your-project/>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
DirectoryIndex index.html
AllowOverride None
Order allow,deny
allow from all
</Directory>
添加 .html DirectoryIndex 以在子文件夹中呈现 html。
关于html - apache 中的文件夹不解释 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51270010/