高手帮忙写个apache的rewrite
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了高手帮忙写个apache的rewrite相关的知识,希望对你有一定的参考价值。
要求是这样的:把
http://www.123.com/abcdefghijk.html
重定向到
http://www.123.com/abc/def/abcdefghijk.html
意思就是说把文件前加两层目录,目录名分别为文件名的第123位和第456位
同理,http://www.123.com/111222333444.html将会被转到http://www.123.com/111/222/111222333444.html
不知道这种需求可以用apache的rewrite完成吗?
1.重新编译apache
2.修改httpd.conf配置文件加载rewrite模块
个人比较支持第二种方式,因为重新编译之后总会出现其他的问题,比如php是否要重新编译等。。
第二种方式的具体操作及注意事项见参考资料。
参考资料:http://hi.baidu.com/bluejack/blog/item/9aa22f29a0e275f699250ab9.html
参考技术A <IfModule mod_rewrite.c>RewriteEngine On
RewriteRule ^(\w3)(\w3)(.*)\.html$ $1/$2/$3\.html
</IfModule>
Java:用axis调用webservice方法时报(400)Bad Request错,请高手帮忙解决下,错误信息如下
AxisFault
faultCode: http://xml.apache.org/axis/HTTP
faultSubcode:
faultString: (400)Bad Request
faultActor:
faultNode:
faultDetail:
:return code: 400
http://xml.apache.org/axis/HttpErrorCode:400
(400)Bad Request
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at com.asiainfo.irpt.action.RptProcessAction.sendFile(RptProcessAction.java:645)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
请求参数没问题,都是定值
参考技术B 路径格式不正确 参考技术C 多半是路径问题追问没有路径信息的
参考技术D 配置问题追问什么配置?
以上是关于高手帮忙写个apache的rewrite的主要内容,如果未能解决你的问题,请参考以下文章