Welcome Guest, Not a member yet? Register   Sign In
$_GET and URI Routing
#1

[eluser]sixpack434[/eluser]
Hi guys, great if someone can help

i'm converting my old website to using codeigniter,the old method of showing lessons on the page is by passing the ID to the url. For example, to show lesson 10 the url would be

www.sitename.com/lesson.php?ID=10

I thought I can use uri routing to pass users to the new page if they try to use the old method e.g.

www.sitename.com/lesson/10

but this doesn't seem to work, my routing functionality is

$route['lesson.php?ID=(\d+)'] = "lesson/$1";

This is throwing a 404 Page not found error

Isn't it possible to solve this problem by way of routing?

Any help is much appreciated
#2

[eluser]JamesD[/eluser]
[quote author="sixpack434" date="1198813998"]Hi guys, great if someone can help

i'm converting my old website to using codeigniter,the old method of showing lessons on the page is by passing the ID to the url. For example, to show lesson 10 the url would be

www.sitename.com/lesson.php?ID=10

I thought I can use uri routing to pass users to the new page if they try to use the old method e.g.

www.sitename.com/lesson/10

but this doesn't seem to work, my routing functionality is

$route['lesson.php?ID=(\d+)'] = "lesson/$1";

This is throwing a 404 Page not found error

Isn't it possible to solve this problem by way of routing?

Any help is much appreciated[/quote]

I believe you would need to do something more like this:
Code:
$route['lesson/(\d+)'] = "lesson/$1";
#3

[eluser]sixpack434[/eluser]
That doesn't work, it works if the user types lesson/2 but it just directs the user to lesson/2? :-|

i want to direct users if they type lesson.php?ID=2 to lesson/2

Thanks for your suggestion

any other ideas?
#4

[eluser]sixpack434[/eluser]
can someone help?

Isn't the routing functionality a way to overcome the missing support of $_GET in codeigniter?




Theme © iAndrew 2016 - Forum software by © MyBB