刚开始学.htaccess文件和目录级重写,请教个可能比较菜的问题,就是发现不能在里面使用相对路径,比如说,用
ErrorDocument 404 http://localhost/test/notfound.html
就没有问题,文件不存在时能正常转到此页面;但教程上使用的都是相对路径啊,比如
ErrorDocument 404 /notfound.html
在我本地测试就会出现错误提示
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.其它比如重写也存在相应的问题。请问是什么地方设置的问题或是要加什么语句么?
ErrorDocument 404 http://localhost/test/notfound.html
就没有问题,文件不存在时能正常转到此页面;但教程上使用的都是相对路径啊,比如
ErrorDocument 404 /notfound.html
在我本地测试就会出现错误提示
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.其它比如重写也存在相应的问题。请问是什么地方设置的问题或是要加什么语句么?
解决方案 »
- 为什么可以登录,但无法连接数据库
- HTML下拉选择如何以POST方法传递多个变量值给PHP?
- 关于点击链接触发事件的问题
- 求助:用HTML代码做个个人简历的表格
- 重新装了下MYSQL,phpmyadmin连不上mysql?
- 对象继承 是怎么用的
- 晕倒,现在才发现这样也会出错
- NuSphere phpED 启动时的问题,谢谢!
- 请问大虾们。为什么使用IMAP函数无法打开虚拟主机提供的邮箱?
- 请教,disczu论坛有时访问会出现The filename ./source/plugin/zhuzhu_taobao/upload/TaokeDetail.
- a标签传过来的参数拼接连接,实现联合查询
- sql语句中where 1=1是什么意思?
ErrorDocument 404 /a/error.php
其中a位于根目录,这个.htacccess就位于a目录内,实现这个功能需要开启目录的重写功能。
AllowOverride All
默认是none
ErrorDocument 404 /notfound.html
改成ErrorDocument 404 /test/notfound.html
这样确实可以了这个目录名是省不掉的么?