1,如何建立 .htaccess文件?
新建一个文本,然后用压缩软件压缩此文本,在压缩文件名处输入 .htaccess,完成!
2,开启.htaccess配置功能
在httpd.conf中设置对目录开启。
AllowOverride All
AllowOverride All
Allowoverride参数详解:http://blog.chinaunix.net/uid-12115233-id-3306876.html
3,打开.htaccess文件添加以下信息
ErrorDocument 404 /404.html ("/"符号代表项目的根目录,404页面可在网上下模板)
4,在根目录下新建404.html
第二种办法:单个项目下添加红色信息,本人配置文件在httpd-vhosts.conf里
点击(此处)折叠或打开
- DocumentRoot "F:\abc\abc.com"
- ServerName
F:\abc\abc.com "> - Options Indexes FollowSymLinks Includes ExecCGI
- AllowOverride All
- Order allow,deny
- Allow from all
- ErrorDocument 404 /404.htm