CodeIgniter Forums
pssing parameters to website base url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: pssing parameters to website base url (/showthread.php?tid=55357)



pssing parameters to website base url - El Forum - 10-23-2012

[eluser]n1c0[/eluser]
Hello everybody, I cannot figure out a clean solution to achieve this result: when somebody enters a url like
Code:
www.example.com/this-controller-does-not-exist
the website treats it like the parameter of a certain controller
Code:
www.example.com/specified-controller/this-controller-does-not-exist
without visually changing the url

I tried some _remapping and things like that, but without any success.
What's the best way to achieve this result?

Thanks a lot!
Nico


pssing parameters to website base url - El Forum - 10-23-2012

[eluser]Mr. Pickle[/eluser]
Set the 404-route in the /config/routes.php file.
Let's say the specified controller is somecontroller you can do.
Code:
$route['404_override'] = 'somecontroller';

From there on you should be able to pick it up further within the somecontroller controller.


pssing parameters to website base url - El Forum - 10-23-2012

[eluser]n1c0[/eluser]
I tried that before. Don't know what it went wrong about it.
Now I tried again and it worked like a charm: thanks for the help!