分类: 系统运维
2008-03-13 13:46:43
|
将上面的内容保存为.htaccess放置到目录下就可以实现我们的目标了,RewriteRule完整的指令如下:
Flag | Description |
---|---|
redirect[=status-code] | Sends a status code between 300 and 400, specified by status-code. The default is 302. |
R[=status-code] | Same as "redirect" |
forbidden | Forces Stronghold to return a status code of 403 ("Forbidden"). This is useful for conditionally blocking URLs. |
F | Same as "forbidden" |
gone | Forces Stronghold to return a status code of 410 ("Gone"). |
G | Same as "gone" |
proxy | Forces the substitution part through the proxy module. The substitution string must be a valid URI. This is useful as a sophisticated alternative to the ProxyPass directive. |
P | Same as "proxy" |
last | Force the rewrite process to end here |
L | Same as "last" |
next | Reruns the rewrite process, starting with the first instance of RewriteRule and using the outcome of the current rewrite process as new input |
N | Same as "next" |
chain | Chains the current rule with the next rule, provided that the current rule matches |
C | Same as "chain" |
type=mime-type | Forces Stronghold to return the file as the specified MIME type |
T=mime-type | Same as "type" |
nosubreq | Indicates that the current rule applies only if the current request is not an internal subrequest |
NS | Same as "nosubreq" |
passthrough | Passes the substitution to the next handler, which should immediately follow the current RewriteRule |
PT | Same as "passthrough" |
skip=n | Skips the next n rules in a sequence if the current rule matches |
S=n | Same as "skip" |
env=VARIABLE:VALUE | Sets the environment variable VARIABLE to the value VALUE |
E=VARIABLE:VALUE | Same as "env" |
如果设置正确后,还不成功,并且apache的错误日志有
[Thu Mar 13 13:47:21 2008] [error] [client xx] Attempt to serve directory: proxy:
[Thu Mar 13 13:47:21 2008] [error] [client xx] File does not exist: proxy: referer:
那是因为没有将apache的代理功能打开,需要修改httpd.conf配置文件,添加
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
将代理功能打开,才能用p命令