URL style PATH_INFO and .htaccess |
[eluser]Unknown[/eluser]
Hi guys, Have a wee bit of a problem, for my application I needed to use query strings to connect with the gowalla.com api. But the way I have it enabled is that you have query strings as well as well formatted links /profile/view/2 etc etc My problem is that the .htaccess file I was using now does not work, i.e. // Will show the login page http://dev.abovefriends.com/index.php/account/login // Will get to index.php but will only show the root page, the /account/login is not being passed. http://dev.abovefriends.com/account/login My config is now setup as so: Code: $config['uri_protocol'] = "PATH_INFO"; My original .htaccess file that worked with uri_protocol = "auto" and query strings set to false. Code: <IfModule mod_rewrite.c> Any help with this is much appreciated, I know the way I have this setup may be a little odd, it is just a shame gowalla cant pass through the information for their api in a post or something. Regards, Pete
[eluser]markup2go[/eluser]
Here is how I had success doing the same thing (query strings in url and pretty urls) Go back to the original .htaccess, which I presume is from the wiki: Code: <IfModule mod_rewrite.c> Not necessary but it might save a headache later to enable more characters in the uri Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\?\=\#\&\-'; Use PATH_INFO as the protocol: Code: $config['uri_protocol'] = "PATH_INFO"; Now, it's been a while and I'm not sure why, but I have query strings disabled: Code: $config['enable_query_strings'] = FALSE; In your controller you'll want to have Code: parse_str($_SERVER['QUERY_STRING'],$_GET); Then you can try to get the query string as necessary Code: $var = $this->input->get('var_name') No guarantee this is going to work for you off the fly but feel free to post your results and I'll see if I can assist further.
[eluser]Unknown[/eluser]
markup2go your are a gent sir! That worked perfectly. I like the idea of parsing the query strings rather than actually having them enabled.. especially as i am just using them for 1 method in gowalla integration. Cheers, Pete
[eluser]jostster[/eluser]
I have done this however in my route I have Code: $route['clothing/(:any)'] = 'products/index/clothing/$1' When I check to see what $1 is in the index function it has the querystring still attached to it. Any idea how to get rid of it before passing it to the function?
[eluser]jostster[/eluser]
I also seem to be having an issue with the above configuration. I copy/pasted that above .htaccess into my .htaccess but the $_SERVER['PATH_INFO'] doesn't work unless i have index.php in my url. Any ideas? |
Welcome Guest, Not a member yet? Register Sign In |