更改默认页面Apache2 Ubuntu
当我访问我的网站时,会显示所有文件的索引,当我选择特定页面时,html无法访问文件中的图像。如何使Apache2自动启动/var/www/home.html而不是/var/www?您可以在虚拟主机上下文中使用DirectoryIndex指令 从 DirectoryIndex指令设置要查找的资源列表, 当客户端通过指定/ 在目录名的末尾 下面是一个例子:更改默认页面Apache2 Ubuntu,ubuntu,apache2,Ubuntu,Apache2,当我访问我的网站时,会显示所有文件的索引,当我选择特定页面时,html无法访问文件中的图像。如何使Apache2自动启动/var/www/home.html而不是/var/www?您可以在虚拟主机上下文中使用DirectoryIndex指令 从 DirectoryIndex指令设置要查找的资源列表, 当客户端通过指定/ 在目录名的末尾 下面是一个例子: <virtualhost *:80> ServerName domain.com ServerAlias www.dom
<virtualhost *:80>
ServerName domain.com
ServerAlias www.domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex home.html index.html
DocumentRoot /var/www
</virtualhost>
ServerName域名.com
ServerAlias www.domain.com
#索引文件和文档根目录(公共文件所在的位置)
目录索引home.html index.html
DocumentRoot/var/www
在Apache2中,在virtualhost
中指定sites available/default
配置文件中的DirectoryIndex
指令对我不起作用。相反,在apache2.conf
文件的DirectoryIndex
标记中放置DirectoryIndex
指令正是我们想要的。以上是特定于目录的范围配置。用于apache环境范围配置。使用url下面的说明,并在dir.conf完美答案中进行更改。如果您使用的是Wordpress,请仅添加DirectoryIndex.php并重新启动apache