Welcome Guest, Not a member yet? Register   Sign In
tell CI not to show part of URL
#1

[eluser]jacobson[/eluser]
Hello, I have a question is there a possibility to tell CI not to show a part of url ?
Because I have a 404 error (made by extending CI_Exceptions). I have error controller and error_404 method inside which loads the view. Now when the 404 appears I want the url to be "clean" and to delete the part of "error/error_404" from it. Is there a possibility of making such a thing ? If not this way mabe some another.

I would apreciate your help
Smile
#2

[eluser]ranjudsokomora[/eluser]
jacobson,
Try using the show_404() function.
http://ellislab.com/codeigniter/user-gui...rrors.html
#3

[eluser]jacobson[/eluser]
yes but I created custom 404 message by creating extended CI_Exceptions
#4

[eluser]CodeIgniteMe[/eluser]
Try exploring the rerouting feature.
#5

[eluser]toopay[/eluser]
Actually you doesn't need to extend that, since as default CI provide 404 overide route.
#6

[eluser]lefoup[/eluser]
[quote author="toopay" date="1310554553"]Actually you doesn't need to extend that, since as default CI provide 404 overide route.[/quote]

Oh, that is a good idea, I hadn't thought of that.

Thanks!
#7

[eluser]jacobson[/eluser]
ok, I've tried this 404_override, changed it to 'myerror/myerror' which loads the view. This worked only for wrong controller but didnt for the wrong method (problem with session). Found this solution
https://bitbucket.org/bubbafoley/codeign...9f04450f25
tried and it... "works" but for wrong controller it shows my custom 404 error and for missing method it shows original 404 error... anyone know how to make it work ? Tongue to show this custom error every time? Smile
thx for responding
#8

[eluser]ranjudsokomora[/eluser]
Hello jacobson,
A quick and dirty way of doing what you want would be to extend CI_Exceptions and then do
Code:
HEADER ("Location: ".$this->config->site_url()."/your404controller/method");
#9

[eluser]CodeIgniteMe[/eluser]
[quote author="ranjudsokomora" date="1310599764"]Hello jacobson,
A quick and dirty way of doing what you want would be to extend CI_Exceptions and then do
Code:
HEADER ("Location: ".$this->config->site_url()."/your404controller/method");
[/quote]

or rewrite it, "The CodeIgniter Way",
Code:
redirect('your404controller/method');

and be aware that nothing should be outputted before manipulating the header information.
#10

[eluser]jacobson[/eluser]
yes but after that I have the error in my URL which I dont want to have there....




Theme © iAndrew 2016 - Forum software by © MyBB