diggy
(Digger A)
December 20, 2010, 3:33pm
1
Hi guys.
I have problem with my urlManager configuration.
For example I have next route
"company/<company:\w+>"=>"/site/showCompany/company/<company>"
When I use url like:
/company/foobar
Then this route works fine.
But when I try to use some latin1 special characters such as æ or å or ø
/company/foobarå
Then this route doesn’t work.
How this can be fixed? I guess that i need to change application locale through set_locale, but I’m not sure.
Thanks.
samdark
(Alexander Makarov)
December 20, 2010, 5:36pm
2
Try
"company/<company:[^/]+>"=>"/site/showCompany/company/<company>"
diggy
(Digger A)
December 20, 2010, 9:18pm
3
Thanks, but this doesn’t work.
I got error:
The URL pattern "<product_id:\d+>/<country:\d+>/<serial:[^/]+>/<mail:[^/]+>/<name:[^/]+>/<company:[^/]+>" for route "/site/index/product_id/<product_id>/country_code/<country>/serial/<serial>/mail/<mail>/name/<name>/company/<company>" is not a valid regular expression.
My route is:
'<product_id:\d+>/<country:\d+>/<serial:[^/]+>/<mail:[^/]+>/<name:[^/]+>/<company:[^/]+>'=>
'/site/index/product_id/<product_id>/country_code/<country>/serial/<serial>/mail/<mail>/name/<name>/company/<company>',
diggy
(Digger A)
December 20, 2010, 9:23pm
4
Sorry, I forgot to escape / inside regex.
Thanks Alex.
mikl
(Mike)
December 21, 2010, 8:10am
5
Just a note: Are you sure you want to use these characters in your URLs? As far as i know only a very specific set of characters is allowed in valid URLs. Moreover i would have no chance to type them on my german keyboard.
See this section of RFC 3986 about URI:
http://tools.ietf.org/html/rfc3986#section-2.3
hpmhpm
(Hasan Paknia)
December 28, 2013, 8:21pm
6
Would you please say how you changed your code? I have the same problem!
scorp13
(Scorp13)
July 31, 2014, 11:11am
7
for those who came from SE
[^/]+ => [^\/]+
majidian
(Majidian)
May 12, 2016, 4:36pm
8
Can i progam url routing by my own laws ?
In good e-commerces like OPEN-CART, MAGENTO,… you have url like this:
mysite.com/мужские-одежди/носки-pumma-желтый-67
I need to find suitable controller, action and id to render the page.