Using pretty URLs in concrete5 with Cherokee

Concrete5 is a very easy to use content management system (CMS). By default concrete5 produces URL's like http://www.walterebert.de/index.php/en/home/. But the index.php in the URL does not contain any relevant meaning. Luckily you can remove it from the URL by activating the "pretty URLs" setting. You will have to use URL rewriting to make it work. Concrete5 automatically shows you which code you have to apply. Unfortunately these are only valid for the Apache web server.

Recently I discovered the Cherokee web server. It is very fast and has a web interface that makes it easy to configure. Problem is that the Apache rewrite code cannot be used. So I had to configure Cherokee to make it work.

Cherokee uses handlers and behavior rules to tell it what to do. To make the URL rewriting work with concrete5 you have to change the handler for behavior "Default" from "List & Send" to " Redirection". Then you have to define the rule to apply. Select "Type > Internal". Then insert ^/(.*)$ under "Regular Expression" and /index.php/$1 under "Substition" .

screenshot of redirection rule in cherokee interface

But now every request is redirected, including all static files such as images. So you have to define handlers for directories and files that need to be accessible.

To do this you have to add behavior rules. Directories that need to be defined are /concrete, /themes and /files. For these directories you should choose rule type "Directory" and handler "Static content".

For files you select the rule type "File exists" and handler "Static content" and add the files that need to be ignored by the rewrite rule.

Make sure that the php rule is listed above any static content rules (you can drag & drop them). Otherwise php scripts won't be processed for those rules and send as static pages with the full source code.

screenshot of behavior list in cherokee interface

Now concrete5 is good to go!

[Update] Cherokee now provides a configuration wizard for concrete5