Configuring URL Rewriting
URL rewriting turns hard to remember, long and complicated URLs into easier to remember URLs. Simple URL rewrite rules per site can be done through Crafter Engine.
CrafterCMS comes with the Tuckey URLRewrite filter, a Java Web Filter with functionality like Apache’s mod_rewrite, that lets you setup rewrite rules for your site.
To add a URL rewrite rule, in Studio, open the Sidebar then click on . Click on Configuration then select Engine URL Rewrite Configuration (XML Style).
Below is a sample URL rewrite configuration.
1<?xml version="1.0" encoding="utf-8"?>
2
3<!DOCTYPE urlrewrite
4 PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
5 "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
6
7<urlrewrite>
8
9 <rule>
10 <from>^/some/olddir/(.*)$</from>
11 <to type="redirect">/very/newdir/$1</to>
12 </rule>
13
14 <rule match-type="wildcard">
15 <from>/blog/archive/**</from>
16 <to type="redirect">/roller/history/$1</to>
17 </rule>
18
19</urlrewrite>
After saving the configuration, remember to publish the configuration file just saved (urlrewrite.xml
file). To publish the configuration file, from the Sidebar, click on Dashboard. In the My Recent Activity widget, check the box next to the urlrewrite.xml
file, and click Approve & Publish from the context nav to publish.
For more information on the UrlRewriteFilter, see http://tuckey.org/urlrewrite/