首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

apache url rewite有关问题

2011-12-06 
apache url rewite问题我的目的,想实现类似www.163.com/blog/username比如我访问http://www.163.com/myspa

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

热点排行