Url Rewrite Filter 实现伪静态
伪静态是相对真实静态来讲的.
通常我们为了更好的缓解服务器压力,和增强搜索引擎的友好面.都将文章内容生成静态页面.
但是有的朋友为了实时的显示一些信息.或者还想运用动态脚本解决一些问题.不能用静态的方式来展示网站内容.
但是这就损失了对搜索引擎的友好面.怎么样在两者之间找个中间方法呢,这就产生了伪静态技术.
开源url重定向过滤器, 实现伪静态
官方地址
http://tuckey.org/urlrewrite/
Based on the popular and very useful mod_rewrite for apache, UrlRewriteFilter is a Java Web Filter for any J2EE compliant web application server (such as Resin, Orion or Tomcat), which allows you to rewrite URLs before they get to your code. It is a very powerful tool just like Apache's mod_rewrite.
?EXAMPLES
???? Redirect one url
??????? <rule>
??????????? <from>/some/old/page.html</from>
??????????? <to type="redirect">/very/new/page.html</to>
??????? </rule>
??? Redirect a directory
??????? <rule>
??????????? <from>/some/olddir/(.*)</from>
??????????? <to type="redirect">/very/newdir/$1</to>
??????? </rule>
??? Clean a url
??????? <rule>
??????????? <from>/products/([0-9]+)</from>
??????????? <to>/products/index.jsp?product_id=$1</to>
??????? </rule>
??? eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.
Stable 2.6
urlrewritefilter-2.6.zip
200kb - md5
Beta 3.1
urlrewritefilter-3.1.0.zip
134kb changelog
?
<filter> <filter-name>UrlRewriteFilter</filter-name> <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class> </filter> <filter-mapping> <filter-name>UrlRewriteFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> Add your own configuration to the WEB-INF/urlrewrite.xml that was created. Restart the context. You can visit http://127.0.0.1:8080/rewrite-status (or whatever the address of your local webapp and context) to see output (note: this page is only viewable from localhost).
SourceStable 2.6
urlrewritefilter-2.6-src.zip
1.5mb - md5
Beta 3.1
urlrewritefilter-3.1.0-src.zip
1.5mb - changelog
?
?