forward slash in url rule parameter


I have a controler ImageController with 3 actions view, restrict, thumbnail

Each action accept a parameter filePath which is the path to the image to be rendered

The server is Apache.

I define the following url rule

'image/<action:(view|restrict|thumbnail)><filePath>' => 'image/<controller>,

using the following url fails:


as well as





Of course, I could use the * char (or any other char) and change it into / in the controller, but it’s not very satisfying.

My question is how could I use the forward / in parameter values ?

Last Edit:

in fact I was misled by permissions in controller

The problem is slightly different. It works with / in the parameter but not when the / is urlencoded (%2F). It means that when using Url::to, the produced URL doesn’t work.


If nothing works then simply use base64 encode / decode for file path.


Have u tried the traditional way?


Because pretty URL meant segregating the query strings by "/" .

I hope somewhat my suggestion helped you.

Thank you for answer.

Apparently it works with traditional Url (not pretty) after removing the rules

But I cannot use pretty Url in this case


If you cannot use traditional URL, I suggest to use base64 encode / decode the filePath

You can make use of the JS -> , in case needed confusion in client side for encoding and decoding.