Url Rewriting on Google App Engine
Web Development, BlueDragon, Google App EngineLately I have been digging in to application development for the Google App Engine running Open BlueDragon. I encountered a need to rewrite and filter some URL's.
The software: UrlRewriteFilter (go get it here) I used the Beta 3.2 version.
The Installation: (borrowed in part from tuckey.org's instructions)
- Move the urlrewrite.xml to the /war/WEB-INF directory.
- Move the urlrewrite-3.2.0.jar to the /war/WEB-INF/lib directory.
- Add the following to your /war/WEB-INF/web.xml.
<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 /war/WEB-INF/urlrewrite.xml that was created.
- Re-deploy your Google App.
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.
-->
<!-- Browser detection -->
<rule>
<condition name="user-agent">Mozilla/[1-4]</condition>
<from>/some/page.html</from>
<to>/some/page-for-old-browsers.html</to>
</rule>




Loading....