Allow urlencoded string in URI |
[eluser]Maxximus[/eluser]
Why would you want to do that? It will kill your SEO. Nobody will ever type that in a searchengine. Nor a plus sign. I would say this works out best for SEO: Code: music/artist/sigur-rós.html You will probably do a db lookup with the above string. In my app I replace all non-ASCII chars with a question mark, that way it will also find 'sigur ros' (but 'sigur rus' too). I make sure my db search is in lower case too, so it will make no difference if someone is using uppercase/lowercase mix.
[eluser]erik.brannstrom[/eluser]
Thanks for your answers! Hm, SEO hadn't even entered my mind. But honestly, for this function it is not a high priority. The parameter is more of a search term than anything else. The process of making every possible artist name SEO friendly seems to be a process I'd rather not go through.. For example, turning spaces into dashes will be a problem when I'm turning them back to spaces for the DB query. A band such as Hard-Fi would therfore not return the exact matches I'm looking for. Maybe I could make a DB table that carries SEO versions of every artist. It seems kind of inconvenient, but maybe it's the best solution. Or are there any other suggestions? By the way, regarding the question if CI is urldecoding the URI, it seems it is in fact mod_rewrite that does the decoding. This is at least what I have found while googling. Should be possible to circumvent by double encoding, but for some reason it fails me.. Oh, and Hannes.. Skönt att veta att det finns fler
[eluser]Colin Williams[/eluser]
You always have the option to override the necessary methods in the URI class by creating an application/libraries/MY_Uri.php file. But these guys are right, people won't type in the character entities, or even the proper character, when typing it out by hand. What you need to do is have a process that rewrites all non-ascii chars into ascii chars before URI class tries to validate it.. I believe this is what some other frameworks/CMSs do
[eluser]Unknown[/eluser]
Check this out... A small patch in URI lib. could allow anyone to safely allow some UTF-8 chars to their stuff: Here's the stuff: How to put UTF-8 characters in your uri string ? As a romanian I had to do this... 1) You just create a MY_URI.php in your application/libraries folder. 2) You open this up: http://webdesign.about.com/od/localizati...des-ro.htm to get the special characters ascii codes. Those are for romanian language but you should look up your language as well. 3) You put this code in the MY_URI.php file you just created: Code: <?php 4) You add this to your config/config.php file to allow Romanian special chars: Code: $config['utf_uri_chars'] = '\xDB\x102\x103\xC2\xE2\xCE\xEE\xDA\x15E\x15F\x21A\x21B\x162\x163'; 6) That's it. 7) Enjoy 8) ............
|
Welcome Guest, Not a member yet? Register Sign In |