Welcome Guest, Not a member yet? Register   Sign In
404 issue with CodeIgniter
#1

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.
Reply
#2

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.
Website: marcomonteiro.net  | Blog: blog.marcomonteiro.net | Twitter: @marcogmonteiro | TILThings: tilthings.com
Reply
#3

Thx, appreciate it!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB