Problems With Url Manager


I have a problem with the url manager.

I like to have URLs like: York/Gas Station XYZ/123134

I tried this:

‘<action:\w+>/<action2:\w+>/<id:\d+>’ => ‘gascontroller/item/region/<action>/station/<action2>/’

This works fine with this url:

but not with one of these York/Gas Station XYZ/123134

Can anyone help me? Thanks…

You shouldn’t use spaces in a URL.

Assuming that you’re happy to always use hyphens (-), try this:

'<action:(\w|-)+>/<action2:(\w|-)+>/<id:\d+>' => 'gascontroller/item/region/<action>/station/<action2>/'

You’ll need to process the action and action2 values afterwards to remove the hyphens.