Hide
on 15/5/07

I just ran across a rather curious problem, which proved to be pretty fatal. I thought I'd jot a note down so I don't forget and so it can be found by others - it also forms reason #6538 why not to develop with a windows machine :).

The Problem

With a standard (1.2) cake install, the colon (:) will be used as the default separator for named arguments; if you decide to use named parameters with your root url, the url will therefore be of the form /something:somethingelse. If you are using windows with apache and mod_rewrite (I'm running with 2.2.4 for the record) you might find that you don't get what you were expecting and are instead confronted with an error message which reads:

Forbidden

You don't have permission to access /something/somethingelse on this server

on 3/5/07

The router is the part of Cake which takes your url and splits it up so the dispatcher knows which controller and action to run. In 1.1 that's about all it does, but in 1.2 the router also works the other way around too - you can feed it an array of controller, action and paramters and it will tell you which url that corresponds to. All of cakes url using/generating methods are hooked into this (with the exception of requestAction at the time of writing) and below are a few hints on how best to make use of this new magic.