DirectoryIndex不起作用

编程入门 行业动态 更新时间:2024-10-24 04:48:50
本文介绍了DirectoryIndex不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用apache2来托管网站。我的目录中有index.html和index.php。

I use apache2 to host a site. There are both index.html and index.php in my directory.

我打开 /etc/apache2/apache2.conf 并添加一行:

DirectoryIndex index.php index.html index.htm

然后重启apache2。但是当我打开 localhost / ~username 时,它会访问index.html。

Then restart apache2. But when I open localhost/~username, it accesses the index.html.

我环顾四周但是可以'找不到问题。我的httpd.conf是空的,我没有.htaccess文件。

I look around but can't find problem. My httpd.conf is empty and I don't have .htaccess file.

设置隐藏在哪里?

编辑:修改 /etc/apache2/mods-availiable/dir.conf 后,找到index.php。

Edit: After I modified /etc/apache2/mods-availiable/dir.conf, it finds the index.php.

但为什么apache2.conf不能覆盖dir.conf?!

But WHY the apache2.conf can't overwrite dir.conf?!

推荐答案

我认为 mod_dir 未加载,尝试命令 sudo a2enmod dir 和服务apache2 restart

I think mod_dir isn't loaded, try to command sudo a2enmod dir and service apache2 restart

更多推荐

DirectoryIndex不起作用

本文发布于:2023-11-01 20:02:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550275.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   DirectoryIndex

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!