Apache URL Rewrite最简配置(一)
假设你已经使用mod_jk2.so整合了Apache2.05x与Tomcat5.x要完成的功能如下重定向:
将URL http://host/test.jps?id=1 重定向为 http://host/1.html
将URL http://host/conent.jsp?id=1&id2=3 重定向为 http://host/1_3.html
1. 修改Apache2\conf\httpd.conf文件,加载mod_rewrite.so
LoadModule rewrite_module modules/mod_rewrite.so
2. 在每个虚拟主机的地方设置Rewrite参数
<VirtualHost *:80>
ServerAdmin wiseweidong@gmail.com
DocumentRoot "I:/Job/Java"
ServerName localhost
RewriteEngine on
RewriteRule /(+).html /test.jsp?id=$1
RewriteRule /(+)_(+).html /content.jsp?id=$1&id2=$2
</VirtualHost>
页:
[1]