- 论坛徽章:
- 0
|
服务器是:FreeBSD+Apache+Tomcat
apache解析静态文件
ajk连接
tomcat解析jsp
/var/www/app目录下有两个文件:154.rar与145.rar,后把154.rar移走到其它目录下
1、下载 http://www.test.com/app/154.rar,返回145.rar,明显不对,用php的get_headers查看了http请求,原来301在做怪。
下载http分析:
var_dump(get_headers("http://www.test.com/app/154.rar"));
array(13) {
[0]=>
string(30) "HTTP/1.1 301 Moved Permanently"
[1]=>
string(35) "Date: Fri, 22 May 2009 15:23:25 GMT"
[2]=>
string(14) "Server: Apache"
[3]=>
string(36) "Location: http://www.test.com/app/145.rar"
2、尝试在apache"禁止"301(添加ErrorDocument 301 /missing.html),访问http://www.test.com/app,产生404,原来是可以的,自动转向到http://www.test.com/app/index.jsp
添加语句前,有Location: http://www.test.com/app/
var_dump(get_headers("http://www.test.com/app"));
array(13) {
[0]=>
string(30) "HTTP/1.1 301 Moved Permanently"
[1]=>
string(35) "Date: Fri, 22 May 2009 15:23:25 GMT"
[2]=>
string(14) "Server: Apache"
[3]=>
string(36) "Location: http://www.test.com/app/"
添加语句后,直接返回/missing.html
var_dump(get_headers("http://www.test.com/app"));
array(9) {
[0]=>
string(30) "HTTP/1.1 301 Moved Permanently"
[1]=>
string(35) "Date: Fri, 22 May 2009 19:36:01 GMT"
[2]=>
string(14) "Server: Apache"
[3]=>
string(44) "Last-Modified: Sat, 04 Apr 2009 17:52:47 GMT"
3、现在的问题是,如何让apache或tomcat下载不存在的文件时,产生http 404状态,而不是301;虽然154.rar与145.rar很像(154.rar已移走),但不是同一个文件,如何更正apache或tomcat的错误。
多谢! |
|