Problems With Url Manager

Hello,

I have a problem with the url manager.

I like to have URLs like:

www.mypage.com/New 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:

www.mypage.com/NewYork/GasStationXYZ/123134

but not with one of these

www.mypage.com/New York/Gas Station XYZ/123134

www.mypage.com/New+York/Gas+Station+XYZ/123134

www.mypage.com/New-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.