Welcome Guest, Not a member yet? Register   Sign In
404 error with only one GET variable
#1

[eluser]jaystang[/eluser]
Hey Guys,
I'm new to codeigniter and I'm hoping some of you can shed some light on how some of this URL stuff is suppose to work.

I'm working to develop a heavily dynamic ecomm site using CI. For SEO reasons I love how CI structures the URL like a directory, however once I get deep into browsing a specific category (think of amazon.com when you're drilling down via the left nav to filter out products) I am forced to use GET variables based on the users selection. Since there is no telling what the user is going to filter by next I can't assume a certain position in the URL for a certain variable. So with that said this is what I'm trying to get my URL's to look like.

http://domain.com/products/browse/produc...=something

So for my code I have a "products" controller with a "browse" method in it that takes in two params, "producttype" and "productcategory". Now with that said I feel like I should be able to access "filter1" from my "browse" method. Instead I get a 404 error. Now the real interesting part is if I add one more GET variable on my url it all works. For example...

http://domain.com/products/browse/produc...mmyvar;You see I have the same URL as before only I added a dummy GET variable on to the end. My code properly picks up the $_GET['filter1'] and I no longer get a 404. Obviously I don't want to have a random dummy variable on the end of all my URL's for no reason. Also it doesn't matter the position of that dummy var. If you switch filter1 and dummyvar it will still work.

Currently my config has the following...
$config['enable_query_strings'] = TRUE;
$config['uri_protocol'] = "AUTO";
#2

[eluser]jaystang[/eluser]
I fixed the problem by changing the uri_protocol to "REQUEST_URI". "PATH_INFO" worked as well.

Clearly something is different when using auto. I looked in the URI.php file and you will see on line 68 it is doing a check for count($_GET) == 1. If you change that to 0 it will also work on AUTO. Not sure exactly what this is trying to do or if this a potential CI bug. If any CI developers read this it might be worth taking a look at.
#3

[eluser]ldg430[/eluser]
jaystang,

Just wanted to thank you for this information!

I was incorporating PayPal's Express Checkout (using tsnax4's library) and ran into this issue when PayPal redirects back to the CANCEL URL (user decides to cancel). PayPal adds a variable ?token=sometoken at the end of the CANCEL URL. On Success (user pays), it adds two variables ?token=sometoken?payerid=someid to the RETURN URL.

My config.php also had

$config['enable_query_strings'] = TRUE;
$config['uri_protocol'] = "AUTO";

CI is able to handle the RETURN URL (two variables) but not the CANCEL URL (one variable). I tried everything from _remap to routing and nothing works until I came across your solution.

Thanks again!
#4

[eluser]DJMOHNL[/eluser]
(almost the) same problem here: http://ellislab.com/forums/viewthread/162407/

follow this one too..
#5

[eluser]Unknown[/eluser]
I just wanted to say thank you. I was having a helluva time getting EE2 to utilize a single GET variable. It works great now.

MANY thanks.




Theme © iAndrew 2016 - Forum software by © MyBB