日期:2014-05-18  浏览次数:20558 次

apache url rewite问题
我的目的,想实现类似www.163.com/blog/username

比如我访问http://www.163.com/myspace/username

forword到   http://www.163.com/myspace/index.jsp?name=username

谁会写...   帮忙了

------解决方案--------------------
写一个过滤器,过滤/myspace/* 如果是http://www.163.com/myspace/username这种形式的话就跳转到 http://www.163.com/myspace/index.jsp?name=username页。过滤器应先判断是否是index.jsp,否则会死循环。
------解决方案--------------------
如果时静态的
Redirect [status] URL-path URL

Redirect /myspace/username http://www.163.com/myspace/index.jsp?name=username


如果时动态的
RedirectMatch [status] regex URL
Redirect /myspace/(.*) http://www.163.com/myspace/index.jsp?name=$1