[19997] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN"
|
---|
| 3 | "http://tuckey.org/res/dtds/urlrewrite2.6.dtd">
|
---|
| 4 |
|
---|
| 5 | <!--
|
---|
| 6 |
|
---|
| 7 | Configuration file for UrlRewriteFilter
|
---|
| 8 | http://tuckey.org/urlrewrite/
|
---|
| 9 |
|
---|
| 10 | -->
|
---|
| 11 | <urlrewrite>
|
---|
| 12 |
|
---|
| 13 | <rule>
|
---|
| 14 | <note>Homepage</note>
|
---|
| 15 | <from>^/$</from>
|
---|
| 16 | <to>/gs3library</to>
|
---|
| 17 | </rule>
|
---|
| 18 |
|
---|
| 19 | <!--
|
---|
| 20 | <rule>
|
---|
| 21 | <note>Collection About Pages</note>
|
---|
| 22 | <from>^/([^/]+)$</from>
|
---|
| 23 | <to>/gs3library?a=p&sa=about&c=$1</to>
|
---|
| 24 | </rule>
|
---|
| 25 |
|
---|
| 26 | <rule>
|
---|
| 27 | <note>Browse Pages</note>
|
---|
| 28 | <from>^/([^/]+)/browse$</from>
|
---|
| 29 | <to>/gs3library?a=b&rt=d&s=ClassifierBrowse&c=$1</to>
|
---|
| 30 | </rule>
|
---|
| 31 |
|
---|
| 32 | <rule>
|
---|
| 33 | <note>Browse Pages with options</note>
|
---|
| 34 | <from>^/([^/]+)/browse.*</from>
|
---|
| 35 | <to>/gs3library?a=b&rt=r&s=ClassifierBrowse&c=$1&cl=CL2</to>
|
---|
| 36 | </rule>
|
---|
| 37 | -->
|
---|
| 38 |
|
---|
| 39 | <!--
|
---|
| 40 |
|
---|
| 41 | INSTALLATION
|
---|
| 42 |
|
---|
| 43 | in your web.xml add...
|
---|
| 44 |
|
---|
| 45 | <filter>
|
---|
| 46 | <filter-name>UrlRewriteFilter</filter-name>
|
---|
| 47 | <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
|
---|
| 48 | <init-param>
|
---|
| 49 | <param-name>logLevel</param-name>
|
---|
| 50 | <param-value>WARN</param-value>
|
---|
| 51 | </init-param>
|
---|
| 52 | </filter>
|
---|
| 53 | <filter-mapping>
|
---|
| 54 | <filter-name>UrlRewriteFilter</filter-name>
|
---|
| 55 | <url-pattern>/*</url-pattern>
|
---|
| 56 | </filter-mapping>
|
---|
| 57 |
|
---|
| 58 | EXAMPLES
|
---|
| 59 |
|
---|
| 60 | Redirect one url
|
---|
| 61 | <rule>
|
---|
| 62 | <from>/some/old/page.html</from>
|
---|
| 63 | <to type="redirect">/very/new/page.html</to>
|
---|
| 64 | </rule>
|
---|
| 65 |
|
---|
| 66 | Redirect a directory
|
---|
| 67 | <rule>
|
---|
| 68 | <from>/some/olddir/(.*)</from>
|
---|
| 69 | <to type="redirect">/very/newdir/$1</to>
|
---|
| 70 | </rule>
|
---|
| 71 |
|
---|
| 72 | Clean a url
|
---|
| 73 | <rule>
|
---|
| 74 | <from>/products/([0-9]+)</from>
|
---|
| 75 | <to>/products/index.jsp?product_id=$1</to>
|
---|
| 76 | </rule>
|
---|
| 77 | eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.
|
---|
| 78 |
|
---|
| 79 | Browser detection
|
---|
| 80 | <rule>
|
---|
| 81 | <condition name="user-agent">Mozilla/[1-4]</condition>
|
---|
| 82 | <from>/some/page.html</from>
|
---|
| 83 | <to>/some/page-for-old-browsers.html</to>
|
---|
| 84 | </rule>
|
---|
| 85 | eg, will pass the request for /some/page.html on to /some/page-for-old-browsers.html only for older
|
---|
| 86 | browsers whose user agent srtings match Mozilla/1, Mozilla/2, Mozilla/3 or Mozilla/4.
|
---|
| 87 |
|
---|
| 88 | -->
|
---|
| 89 |
|
---|
| 90 | </urlrewrite>
|
---|
| 91 |
|
---|