External links adding parameters - how to allow these without allowing query strings? - 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: External links adding parameters - how to allow these without allowing query strings? (/showthread.php?tid=23251) |
External links adding parameters - how to allow these without allowing query strings? - El Forum - 10-05-2009 [eluser]mattpointblank[/eluser] Hi all, Our email newsletter script adds the following string to any URLs we put inside it: ?utm_source=MailingList&utm_medium=email This breaks my site with the 'disallowed URL characters' error. I don't want to enable query strings because this breaks some of my other links and makes things like pagination URIs look ugly which I don't want. There's no way to turn off these referral links, so how can I make them work? Methods I've tried: 1. Adding a .htaccess rule (gave a 500 server error...) 2. Adding a routes.php rule (the only time I got it to work meant that 'normal' links failed) 3. Experimenting with different characters in the permitted_uri_chars config item (nothing happened) 4. Combinations of values for uri_protocol and enable_query_strings (see above) If it helps, the structure of my URLs is like this: Code: $route['review/(:any)/(:any)/(\d+)'] = 'review/view/$3'; I tried adding this but it failed to work: Code: $route['review/(:any)/(:any)/(\d+)?(:any)'] = 'review/view/$3'; Any ideas? External links adding parameters - how to allow these without allowing query strings? - El Forum - 10-05-2009 [eluser]bitist[/eluser] [quote author="mattpointblank" date="1254756408"] ?utm_source=MailingList&utm_medium=email [/quote] I think % is allowed in the URL. Using PHP function urlencode make your string to look: Code: %3Futm%5Fsource%3DMailingList%26utm%5Fmedium%3Demail You should try to use in this way: Code: yourdomain.com/controller/function/%3Futm%5Fsource%3DMailingList%26utm%5Fmedium%3Demail External links adding parameters - how to allow these without allowing query strings? - El Forum - 10-05-2009 [eluser]mattpointblank[/eluser] I can't change the string that gets appended, that happens automatically from the email software. Also, I don't really want to hardcore the string into a function argument (if that's what you mean) in case it changes etc. |