Re: SEO URL supporting l10n/i18n with PrettyFaces
Hello Lincoln, hello Christian,
with great interest I read your articles about PrettyFaces and a lot of entries in the support forum regarding URL rewriting and l10n/i18n support.
I’m in process of creating a complete new website with JSF2.1. Structure and content are almost ready now. The l10n/i18n implementation is based on standard mechanism of HTTP, Java and JSF (Locale, ResourceBundle, etc.). Currently I provide two languages (german and english) but in the future there could be some more (french and italian) eventually.
How it works today:
There is no langugae information provided with the URL, the language becomes selected based on the Locale in the HTTP header, provided by the browser.
If the user prefers another language, he/she could choose it with a selector provided on the website (english | deutsch). This functionallity is implemented by page fragment
global_common.xhtml (used by the main template for the whole website) and the managed bean
LocaleHandler.java. It works very well.
Now I like to create a SEO URL supporting l10n/i18n as follows:
Always the welcome page should be accessible by the URL as follows:
Always during processing of the request, a two character language information (e.g.
de, here marked with
<language>) should be inserted into the URL, after the top level domain (here marked with
<tld>) immediately, as follows:
- for the welcome page:
- for any other arbitrary page:
The environment is as follows:
- GlassFish 184.108.40.206 (build 5)
- JSF 2.1.14
- PrettyFaces 3.3.3
Attached please find the files as follows:
In my opinion all seems to be straight forward. But unfortunately after reading and trying a lot of suggested approaches I couldn’t get it working yet.
I would be very happy if you could give me some advice.
I could imagine that would also be very helpful for many others who also struggle with this challange.