Sunday, May 8, 2011

Pokemon Heart Gold Wpa

URLRewrite




A good practice to publish our restful url formats. Where data from the query are part of the url, this greater acceptance from the user and search engines. For example, my site features the profile of my users, if wishing to be publishing the profile of John the url would be something like:

http://misitio.com/profile/juan

This is more friendly than this:
I think this we all agree. Many times in our java projects can not do this, as the web framework does not. For these cases there URLRewrite, which allows our url rewriting as we want; eye not only be used for restful url but for any change we would like to make our urls.
First download the maven jar or if we add this in the pom.xml






org.tuckey


urlrewritefilter


3.1.0
 


Then we must add the following filter in the web.xml:

UrlRewriteFilter


org.tuckey.web.filters.urlrewrite.UrlRewriteFilter

 


UrlRewriteFilter
/ *


Now we must write a file containing the URLs change, the file must be called urlrewrite.xml:







 

/ profile / ([az] +) $

/ mysite / profile / index.htm? name = $ 1





can see in the file that there is from (the url that the user) and to (the real url of your system) with $ 1 are indicating that the first parameter is the variable in the url destination. This foma
we set our url so they are more beautiful.

leave links:

http://www.tuckey.org/urlrewrite/

http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html







0 comments:

Post a Comment