Welcome Guest, Not a member yet? Register   Sign In
Mixing query and segment based URL types
#1

[eluser]BrandonDurham[/eluser]
I have a CI site set up with the default segment based URLs but need to be able to link to the site with the Google Analytics query string (i.e. - http://www.website.com/case_study/buycom...dium=email

Is there a way to use both?
#2

[eluser]Colin Williams[/eluser]
Yes. Set enable_query_strings to TRUE. Magic, eh?
#3

[eluser]BrandonDurham[/eluser]
I did that and got the "404 Page Not Found: The page you requested was not found." error.
#4

[eluser]bretticus[/eluser]
One of my pet peeves with CI: The developers insistence to not allow query strings of any kind mingled with the segment URI approach. Sometimes you just need a query string! BTW, If you set enable_query_strings to TRUE, you have to use query strings throughout. There are countless posts on this issue and the only thing I remember as a solution is to use mod rewrite (htaccess file) for your google analytics URLs. Then again, ten people will probably post saying I'm wrong and nuts and give you better information. You're welcome! Smile
#5

[eluser]Colin Williams[/eluser]
All I do is set enable_query_strings to TRUE and uri_protocol to PATH_INFO and I'm off to the races
#6

[eluser]bretticus[/eluser]
[quote author="Colin Williams" date="1264584617"]All I do is set enable_query_strings to TRUE and uri_protocol to PATH_INFO and I'm off to the races[/quote]

Okay, fair enough. I haven't had a need to implement mixing them before but how do you handle URLs:

Quote:If you change "enable_query_strings" to TRUE this feature will become active. Your controllers and functions will then be accessible using the "trigger" words you've set to invoke your controllers and methods:
index.php?c=controller&m=method

Please note: If you are using query strings you will have to build your own URLs, rather than utilizing the URL helpers (and other helpers that generate URLs, like some of the form helpers) as these are designed to work with segment based URLs.

I guess I can live without anchor, etc. but the last time I tried this (about a year ago) it seemed like segmented URLs no longer worked. If they do work for most everyone else, pardon my ignorance (although, I still might miss those URL functions.) Smile
#7

[eluser]bretticus[/eluser]
Gotta love Jamie our Community chieftain. (Looks like he took the time to actually dig into the framework and extend it a little.)

Check out his modifications here. This is a little old, and I haven't tested it, but it worked for other posters in the thread.




Theme © iAndrew 2016 - Forum software by © MyBB