apache自定义404页面

眉间皱痕 提交于 2020-03-13 07:00:45

 

1.开启rewrite_module模块  参考路径 D:\PC_webserver\apache\conf\httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

2.搜索Directory 找到对应的目录。红色的字为网站目录 加粗为修改部分

<Directory "D:/PC_webserver/phproot">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

还有一个地方

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>

3.根目录建立.htaccess文件 以下是内容 然后重启apache 第一个404是状态码  

参考资料 http://www.tuicool.com/articles/NFfUBj3

ErrorDocument 404 /404.html

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!