我想设置一个Apache重定向规则,该规则将接受以下浏览器URL:
192.168.100.128/test
并将其转换为以下内容:
http://192.168.100.128:9001/forms/frmservlet?config=testjpi
我看过httpd.conf并试图同时使用Alais和Rewrite模块,但我无法工作。
别名:
Alias /test http://192.168.100.128:9001/forms/frmservlet?config=testjpi
还有重写:
<IfModule rewrite_module>
RewriteEngine on
RewriteRule http://192.168.100.128/test http://192.168.100.128:9001/forms/frmservlet?config=testjpi
RewriteRule /test http://192.168.100.128:9001/forms/frmservlet?config=testjpi
</IfModule>
任何想法,如果我正在做的事情甚至是可能的,如果可以的话,我该如何做到正确?我对Apache的了解有限,所以我有点盲目。
TIA。
答案 0 :(得分:1)
Alias不会处理仅适用于目录的URL。
尝试:
Redirect permanent /test http://192.168.100.128:9001/forms/frmservlet?config=testjpi
了解更多文档:http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect