URL-encoding in redirect? - 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: URL-encoding in redirect? (/showthread.php?tid=19561) |
URL-encoding in redirect? - El Forum - 06-11-2009 [eluser]Christoffer[/eluser] Hey, I am building a search function and I need to create easy to read URLs for bookmarks etc. This is a Swedish application first which means we need to support some special characters (å, ä, ö) that are not supported in URLs. Therefore I need to encode the variable before it's posted to the user. The PHP function rawurlencode() works when I print the variable with echo() but neither redirect() nor header("Location: x") uses the encoded value. Why is this and how can I work around it? Code: <?php Thank you! URL-encoding in redirect? - El Forum - 06-11-2009 [eluser]cindor[/eluser] hi, you can use 2-way encryption algorithms. by using CI's enrypt library you can first encrypt the encoded string and then in your search method first decrypt the string then decode that string. URL-encoding in redirect? - El Forum - 06-11-2009 [eluser]Christoffer[/eluser] That might work, but the link wouldn't be easily readable which I prefer. The same function would be used for some hyperlinks that needs to be SEO-optimized. URL-encoding in redirect? - El Forum - 06-11-2009 [eluser]cindor[/eluser] for SEO you can create a replace function which replaces unsupported chars with SEO-optimized ones. but this way you may not be able to query the database. if i were you i would send 2 parameters. /search/seo-optimized-query-string/enrypted-query-string and i would use the decrpyted and decoded third parameter for querying the database URL-encoding in redirect? - El Forum - 06-11-2009 [eluser]Christoffer[/eluser] That was an interesting idea. I'll go with that Thanks a bunch! |