Welcome Guest, Not a member yet? Register   Sign In
I need help to create a route in order to execute a controller method
#1

[eluser]luismartin[/eluser]
I've got this route:

Code:
$route['((\w{2}/)?)product/download\?image\=(.+)\.jpg$'] = 'product/download/$3/image/jpg';

I can't get it working though.

If I directly enter the rewrite with some image, it works.

Any idea?
#2

[eluser]luismartin[/eluser]
anyone please?
#3

[eluser]Matalina[/eluser]
Your regex says to me

(rt/)product/download?image=something.jpg where the parenthesis are optional

So unless your url will look like: http://somedomain.com/(index.php/)(rt/)p...ething.jpg where the parenthesis are optional

I'm not sure what you are using ((\w{2}/)?) for Chances are you don't need it it says you need exactly 2 characters(a-z or A-Z) before a / and that can be matched 1 or 0 times. So if there are 3 letters before it you will fail your regex.

also check your permitted characters in your config file = and ? are not allowed out of the box.
#4

[eluser]luismartin[/eluser]
Hey Matalina,

the ((\w{2}/)?) part is needed for a languages segment. As it is optional, whenever it's not present, the default language is displayed. The routes assigned for any language are two chars (en => English, de => german, etc)

Anyway I decided not to use the query string and use the SEF route directly.

Regarding your suggestion about the config file:

If I enabled query strings, should I add = and ? (and optionally &) to the 'permitted_uri_chars' config parameter?




Theme © iAndrew 2016 - Forum software by © MyBB