Welcome Guest, Not a member yet? Register   Sign In
[Solved] Routing issue - need to redirect from url parameterized pages to new CodeIgniter nice urls
#11

[eluser]ehicks727[/eluser]
I echoed the $_GET['id'] in the routes file, and it is, in fact, finding it... it's just not routing it... let me try some more debugging.
#12

[eluser]BrianDHall[/eluser]
I ran into that problem to. I was thinking it wasn't working, then I closed my browser and opened a new one after clearing cache.

Suddenly it worked, I presume I had a caching issue of some sort.

The other issue is the default controller. If you visit the site directly with nothing else defined, it has a tendency to skip routing completely.

For that you'll need to use the if($_GET['id']) check on the setting of default controller, and route it appropriately to your rerouted controller.
#13

[eluser]ehicks727[/eluser]
I actually want to force a server 301 redirect, not just re-route the page... is there any reason I can't do this in the routes.php file?

Code:
if ($_GET['id']) {
    redirect("/redirectstories/story/".$_GET['id'], 'location', 301);
}

It's not working right now, but I haven't cleared my cache, like you mentioned above.. I'll do that next.
#14

[eluser]ehicks727[/eluser]
[quote author="BrianDHall" date="1257204765"]For that you'll need to use the if($_GET['id']) check on the setting of default controller, and route it appropriately to your rerouted controller.[/quote]


That worked.. thanks. I just put this into my default controller and it works great. Thanks for your help, I really appreciate it!

Code:
if ($_GET['id']) {
    redirect("/redirectstories/story/".$_GET['id'], 'location', 301);
}




Theme © iAndrew 2016 - Forum software by © MyBB