![]() |
Linking to my site with a ?var=val style url (Solved) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Linking to my site with a ?var=val style url (Solved) (/showthread.php?tid=22652) |
Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]laytone[/eluser] I have an affiliate site (clickbank) linking to my site. When somebody click on clickbanks affiliate address link it hops them to my website like this: http://mysite.com/?hop=affiliateid Of course this is throwing a 404. I don't need the hop variable they send it in case I need but they send it no matter what. What can I do? Can i set up a rout that will just redirect them to my home page. How would I do this correctly? Thanks in advance. Layton Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]daparky[/eluser] What you need to do is open the config.php file located in the application/config directory and change this: Code: $config['uri_protocol'] = "AUTO"; to Code: $config['uri_protocol'] = "QUERY_STRING"; and then change this: Code: $config['enable_query_strings'] = FALSE; to Code: $config['enable_query_strings'] = TRUE; Or, check this out: http://ellislab.com/forums/viewthread/56389/#277621 Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]laytone[/eluser] If I do this will my normal /controller/method/var/var2 URIs still work? Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]daparky[/eluser] As far as i remember they should still work, give it a try and let me know how you get on. It's worth taking a look through this thread: http://ellislab.com/forums/viewthread/56389/#277621 Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]laytone[/eluser] My uri segmants still work, and I no longer get a 404. But I do get this error: The URI you submitted has disallowed characters. How can I remap it now? Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]daparky[/eluser] What parameter is the affiliate site passing back to yours? Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]BrianDHall[/eluser] In the config file there is a list of allowed characters, something like this: Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\-\?&=;,'; Yours won't look like that, but mine is setup this way for debugging (those two dashes look the same, but they are actually different UTF-8 encoded versions of a dash that was throwing errors in my system - go figure). So just add the characters that need to be passed gently to your site to this string in config.php and that should do it. Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]laytone[/eluser] I have been able to solve my problem and here is how. (All thanks to daparky) Using this post: http://ellislab.com/forums/viewthread/56389/#277621 and this code from that post: config file: $config['uri_protocol'] = "PATH_INFO"; Extend Input Class: class MY_Input extends CI_Input { function _sanitize_globals() { $this->allow_get_array = TRUE; parent::_sanitize_globals(); } } I can access the variable with this: $this->input->get('varName') and Everything works like gold. Linking to my site with a ?var=val style url (Solved) - El Forum - 09-16-2009 [eluser]daparky[/eluser] [quote author="laytone" date="1253143866"]I have been able to solve my problem and here is how. (All thanks to daparky) Using this post: http://ellislab.com/forums/viewthread/56389/#277621 and this code from that post: config file: $config['uri_protocol'] = "PATH_INFO"; Extend Input Class: class MY_Input extends CI_Input { function _sanitize_globals() { $this->allow_get_array = TRUE; parent::_sanitize_globals(); } } I can access the variable with this: $this->input->get('varName') and Everything works like gold.[/quote] Glad i could help. Linking to my site with a ?var=val style url (Solved) - El Forum - 09-23-2010 [eluser]patwork[/eluser] And here's my solution. Note that everything from first '&' to end of the uri is removed. Code: class MY_URI extends CI_URI |