Description
The XML Rule example given is the following:
<rule> <note> This rule means that requests to /test/status will be redirected to /rewrite-status. </note> <from>/test/status</from> <to type="redirect">/%{context-path}/rewrite-status</to> </rule>
The bug is the leading / before the %
{context-path}: that should not be as it will produce // (double slash) as result (context-path, if not empty, always starts with a /).
So the example rule should be:
<rule> <note> This rule means that requests to /test/status will be redirected to /rewrite-status. </note> <from>/test/status</from> <to type="redirect">%\{context-path}/rewrite-status</to> </rule>
Another problem is that the example is provided as a separate file resource in the document content yaml definition (sample-rewriter-rules.yaml):
urlrewriter:rule: type: string resource: sample-rule.xml
While that is fine for initial bootstrapping, it is less convenient (problematic really) when it is changed, because auto-export currently cannot export it back to a (or even the) file resource! While that is possible (and done) for certain/known String properties for hcm-config definitions, but not for hcm-content definitions!
The result is that after editing the XML Rule, it gets inlined in the content document anyway, like this:
urlrewriter:rule: |-
<rule>
<note>
This rule means that requests to /test/status will be redirected to /rewrite-status.
</note>
<from>/test/status</from>
<to type="redirect">%{context-path}
/rewrite-status</to>
</rule>
Therefore I think it is better to change the URL Rewriter example using the inlined rule content, like above.
Arggggh: nevermind the above crappy/broken inline content example: Jira seems to not being able to retain the proper rendering, I've tried to fixed it several time. Not working!