html - apache 中的文件夹不解释 html

标签 html css

我在 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/

相关文章:

javascript - 使用 jquery 更改 css 值

javascript - Mustache .js 在 html 模板中显示

html - -webkit-边框图像 : -webkit-linear-gradient only for left border

javascript - 部署静态站点时如何替换JS和CSS引用?

java - 如何在robotium中获取textview的背景颜色

html - 页面与内容的 CSS 背景图像对齐

javascript - 提高 Canvas 效果的实时性能

jquery - 使用 jquery 和 css 进行旋转和反向旋转

html - 如何删除内联/内联 block 元素之间的空间?

css - 网页中的字体看起来更粗(白色,深色背景)