In Enterprise environments, Jahia can be installed over other application Servers like JBoss. So in this post I want to explain how urlrewrite works with the Java API Tuckey that can be integrated in Jahia Enterprise installations. Also Jahia WCM can easily be leveraged to create SEO (Search Engine Optimization) Friendly URLs by your content editors.
Tuckey is a Java filter that permits J2EE web applications to implement urlrewrite based on the Apache mod_rewrite. This filter uses a configuration file called urlrewrite.xml located in the WEB-INF directory of your application. The way to enable Tuckey in JBoss is to modify the web.xml file of the instance for which you want to enable rewrite. This file is located in the WEB-INF directory and you need to enable Tuckey filter including the following configuration:
set the amount of seconds the conf file will be checked for reload
sets up log level
Note that in the mapping section we are applying the UrlRewriteFilter to all the requests, and in the Filter section we are configuring the location of the filter class using the qualified name org.tuckey.web.filters.urlrewrite.UrlRewriteFilter. You need to be sure that the Tuckey jar is in the classpath of the web application. You can put that jar in the folder WEB-INF/lib/ of your JBoss installation. Now urlrewrite is enabling and you can put your rules in the file urlrewrite.xml located in the WEB-INF folder.
From the editor perspective it is easy to assign friendly URLs. The following screenshot shows how easy it is to assign a friendly url to a Jahia page. The content author just needs to go to the Page settings option and assign a Page URL Key containing the URL alias for the current page.
A situation to use JBOSS rewrite rules for is when you have an Apache server acting as a Proxy in front of your JBoss Application Server. To configure Apache to act as a proxy you need to connect via ajp to the JBoss server. To do that you need to add the following code in the default VirtualHost configuration:
ProxyPass / ajp://192.168.2.110:8009/jahia/cms/
ProxyPassReverse / ajp://192.168.2.110:8009/jahia/cms/
Where jahia/cms is the location of jahia instance.
Then you need to add the proper rules in the urlrewrite.xml in order that images and friendly urls appear correctly. Following is a sample rule that makes correct calls to the template resources used in the template set like css and template images.
Template resources rule