Use the URL Rewriter
Overview
In the CMS' Content application, URL Rewriter adds an extra section (to Documents, Images etc.). Clicking on a folder in the lefthand-side navigation tree reveals an overview of the rules in that folder, with some extra information like the from, to and type of redirect. Note that this does not display the conditions, if there are any. The rules are processed in the order they appear, so keep this in mind when creating rules of different depth. For example, the rule rewriting /abc should come after the rule rewriting /abc/def.
Which rules and conditions have been configured and in what order they will be processed can be seen on the status page, which is accessible locally at /rewrite-status. See also the corresponding configuration in the site module's web.xml.
Configuration
The global configuration of URL Rewriter is stored as module configuration, on
/hippo:configuration/hippo:modules/urlrewriter/hippo:moduleconfig
The following properties can be set, through the Hippo Console:
Property | Explanation | default |
---|---|---|
urlrewriter:ignorecontextpath | setting this to false will require you to prefix all the URLs you want to match with the contextpath, use this if you don't strip the context path from your URLs | true |
urlrewriter:usequerystring | when set to true, the query string is taken into account when matching URLs | false |
urlrewriter:skippedprefixes | a multiple string, where each value is a prefix that should not be rewritten | {/_cmsinternal, /_cmsrest, /_cmssessioncontext, /_rp, /hn:, /ping/} |
urlrewriter:skippost | when set to true, POST requests will not be rewritten | true |
urlrewriter:disallowedduplicateheaders |
a multiple string, where each value is a response header for which duplicates will be filtered out. While most headers are allowed to contain multiple values (a good example is Cache-Control header), |
Access-Control-Allow-Origin |
Adding Rules
When creating a new rule, there are three options:
Rule Type | Explanation |
---|---|
Rule | This type is the most simple to use, and should cover all the common use cases |
Advanced Rule | This type supports conditional rewrites and is regular expression based. It should be able to cover almost any use case. |
XML Rule | Here you can add XML Rules in the format supported by the underlying software, Paul Tuckey's Url Rewrite Filter |