We have a website which is coded Java with Struts Framework. The WebSite's Urls are not seo friendly. All of them are like below
../buyerApplication.do&companyId=2323
Now We want to make these URLs SEO friendly and I searched and found these soluti开发者_C百科ons:
- tuckey.org/urlrewrite : but i don't rely on this system.
- adding title end of link after '&' such as "../newsId=33233&does-art-in-the-city-equal-art-for-the-city" : In this solution I am not sure it works well.
I am waiting your sugestions to solve this problem best.
I actually used URLRewriter (http://tuckey.org/urlrewrite/), which you referenced in your original question. It was very easy to set up and filled my needs perfectly.
To the point, you need a Filter for this.
If you want to keep your existing application's architecture, you'll need to define and create a set of rules to convert unfriendly urls to friendly urls and let the filter convert it and forward the request to the unfriendly url.
If there is no means of modifying an existing application but you want to create a new application based on this idea, you could consider to having a single page controller which translates the HttpServletRequest#getPathInfo()/getRequestURI() to execute the appropriate action class (command pattern) and finally forward the request to the appropriate JSP page. Not sure how that would fit into Struts as I haven't worked with Struts previously.
For what it's worth, you can also look at the REST plugin http://struts.apache.org/2.x/docs/rest-plugin.html, which amongst other things will make your URLs more friendly
精彩评论