CodeIgniter Forums
404 issue with CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: 404 issue with CodeIgniter (/showthread.php?tid=76988)



404 issue with CodeIgniter - KristyStevens - 07-09-2020

Hi guy,

I'm working on a little URL shortner, just for fun, using CodeIgniter.
I have a URL like this:


Code:
index.php/home/new_url/http%3A%2F%2Fgoogle.com
This should call a controller called 'home', a function called 'new_url', and in terms of CodeIgniter, that last bit would be known as [i]$this->uri->segment(3)[/i]. Instead, I get this:


Code:
Not Found
The requested URL /index.php/home/new_url/http://google.com was not found on this server.


I should note that it isn't a 404 page generated by CodeIgniter, but the standard Apache 404 page.


I can take off [i]http%3A%2F%2F[/i], or just the third URI segment entirely, and it goes to the new_url function perfectly. Maybe I'm having a brainfart and missing some wildly obvious thing. I'm not sure where the URL is becoming un-urlencoded.


Thanks a bunch. I love you all.



RE: 404 issue with CodeIgniter - marcogmonteiro - 07-10-2020

the url you're setting after home I would use that as query string and not as a uri segment.

So something like

/index.php/home/new_url?shorten=http://google.com

Otherwise codeigniter would identify those // as new uri segments. Also you would have to check your settings to see if those : and . are allowed. But if you use query strings you don't need any of that.


RE: 404 issue with CodeIgniter - shonnajoe - 12-21-2020

Thx, appreciate it!