Welcome Guest, Not a member yet? Register   Sign In
routing problem with added get vars
#1

[eluser]dulakian[/eluser]
Hello,

I just completed a project using code igniter, and it runs great. I'm having a problem with a route issue that I can't seem to solve.

I have this setup to allow me to set tracking ids based on the url:

$route['track/(.*)'] = "track/index/$1";

This works great for what I need except when any get vars are put onto the end of the url:

/track/trackingid/?var=blahblah

This uri causes a 404, instead of feeding the trackingid to track....

I can't seem to figure out how to make the routing ignore anything past the trackingid. I have to be able to accept these types of url, even though I don't want to touch the get vars at all, I simply want to ignore them, or drop them.

PPC networks add their click tracking ids as get vars onto any url you supply them as a landing page, and this is breaking my app. I can't get google or yahoo to not supply get vars on the end of the url, so I'm simply looking for the correct way to drop them or ignore them, and still serve up my controller correctly. Anyone have any idea?

Michael
#2

[eluser]Dam1an[/eluser]
Have you tried all the URI protocols in the config file?
#3

[eluser]dulakian[/eluser]
[quote author="Dam1an" date="1242824598"]Have you tried all the URI protocols in the config file?[/quote]

Nope I hadn't tried that but using PATH_INFO and adding \? to the permitted_uri_chars solved the problem for me. Thanks a ton, I didn't even realize the uri_protocol option was in the config. It was an expensive lesson, I turned on a campaign last night and blew through almost $100 in 24 hours... Thanks very much for the help, you guys rock.

Michael
#4

[eluser]Dam1an[/eluser]
Smile Glad to be of help
I've never yet had to use anything other then AUTO, but its normally the first thing you should try if you have problems linked to the URI
#5

[eluser]Colin Williams[/eluser]
Quote:I’ve never yet had to use anything other then AUTO, but its normally the first thing you should try if you have problems linked to the URI

So says the User Guide. Imagine that.
#6

[eluser]Dam1an[/eluser]
Wait! We have a user guide Tongue
#7

[eluser]Colin Williams[/eluser]
That's what I hear on the streets, Dam1an. You gotta be in the know, though.
#8

[eluser]dulakian[/eluser]
[quote author="Colin Williams" date="1242828418"]
Quote:I’ve never yet had to use anything other then AUTO, but its normally the first thing you should try if you have problems linked to the URI

So says the User Guide. Imagine that.[/quote]

Could you link to where in the User Guide it says this? I did many searches on the User Guide trying to find an answer to my problem before I came here. Code Igniter is great, but the User Guide is not intuitive, nor is it easy to find things that apply to problems you might encounter. I expected this type of information to be listed under "CodeIgniter URLS" or "URI Routing" or "URI Class" or "Troubleshooting" or maybe even under "URL Helper". It's not listed in any of those places. Where is it? Even knowing the solution I am unable to find the section you are referring to using the search function at the top of the page.

Usually I'm a much nicer guy, but RTFMing me after I searched extensively is just assinine. Especially since the guide you refer to is laid out in such a crappy manner. Don't get me wrong, I understand RTFM, but you just did it on an extremely obscure solution, not listed in the top 5 places any sensible person might be expected to look for it. Good job, sparky.

Michael
#9

[eluser]Dam1an[/eluser]
I think you're the first person to have a problem with the User guide...
Did you think to maybe look under the trouble shooting section?

One of the first sections you should read... you know, once you've read the installation part

Quote:If you find that no matter what you put in your URL only your default page is loading, it might be that your server does not support the PATH_INFO variable needed to serve search-engine friendly URLs. As a first step, open your application/config/config.php file and look for the URI Protocol information. It will recommend that you try a couple alternate settings.
#10

[eluser]dulakian[/eluser]
[quote author="Dam1an" date="1242836721"]I think you're the first person to have a problem with the User guide...
Did you think to maybe look under the trouble shooting section?

One of the first sections you should read... you know, once you've read the installation part

Quote:If you find that no matter what you put in your URL only your default page is loading, it might be that your server does not support the PATH_INFO variable needed to serve search-engine friendly URLs. As a first step, open your application/config/config.php file and look for the URI Protocol information. It will recommend that you try a couple alternate settings.
[/quote]

I don't have a problem with the User Guide, it just wasn't apparent where the solution to my problem was, and even searching for the solution does not pull up the page you linked. I'm sorry I got a little pissed at his sarcasm, it's not like I didn't try to find the info I was looking for before I came here. It just rubbed me the wrong way his snide attitude about it. I like the framework, the docs are better than a lot out there, I just don't appreciate the superior attitude in the reply to my request for help. I got the solution, I'm happy. Hopefully this thread will help other people who have the same problem I did. I'll let it go now...

Michael




Theme © iAndrew 2016 - Forum software by © MyBB