I want to have SEO friendly urls in my application, which will be built in java/j2ee using Struts (1/2).
I have some classifications as follows
county/countryname
county/state/statename
county/state/locality/localitname
I guess above URLs will be seo friendly?
How can I have such URLs with Struts instead of something like /county='xyz'
?
I don't think this can be done with Struts. You'll need Filters in order to achieve this.
You can use Apache mod_rewrite, it will convert your URLs like
http://myapp.com/u/nishant/page/account/tab/3
tohttp://myapp.com?u=nishant&page=account&tab=3
. So, your app don't need to worry about how URL structure.Alternatively, you may use URLRewriteFilter, which is nothing but a cleverly written filter that need to the first filter of your application and all the requests should pass through this. It follows the same pattern rules as Apache mod_rewrite.
use urlrewrite library, it will integrate nicely with most of the java web frameworks.
example from here: