Welcome Guest, Not a member yet? Register   Sign In
The URI you submitted has disallowed characters: $1
#6

[eluser]BrianDHall[/eluser]
[quote author="Takapaka" date="1256694517"]Actually nothing more complex than routing url like:

www.site.com/gifts/users_gifts_public/john/654

(where john would be user name, and 654 his id)

to

www.site.com/john/654[/quote]

You're in luck, I had a strange urge to play with regex Big Grin

All tested and guaranteed working or your money back Wink

You have two options:

Code:
$route['([a-z_A-Z]+/[0-9]+)'] = "gifts/users_gifts_public/$1";

Before Route: john/654/123/123
After: gifts/users_gifts_public/john/654

Notice the other stuff after gets knocked off, so if you add anything else after you will find 404s or other unexpected behavior.

So what I recommend instead is:

Code:
$route['([a-z_A-Z]+/[0-9]+.+)'] = "pensacola_coupons/test/$1";

Before Route: john/654/123/123
After: gifts/users_gifts_public/john/654/123/123

Quod erat demonstrandum.

Resources for regex in the future: http://www.regular-expressions.info

And any editor that supports regex for search/replace functions. I keep EditPlus around for this, but any that supports regex will do. Much easier and faster to test in an editor than inside PHP script.

Enjoy!


Messages In This Thread
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 01:08 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 01:35 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 02:09 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 02:35 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 02:48 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:29 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:37 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:46 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:55 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB