URL Rewriting: Name instead of ID |
[eluser]KingSkippus[/eluser]
[quote author="mddd" date="1279714564"]If you use a REAL encoded string, including special characters, people won't be able to type it in. I mean, what user knows url encodings by heart? My guess is that it would be better to lose the accents and use 'regular people's writing'. authors/josé nuñez is a LITTLE BIT harder to read, let alone write, than authors/jose_nunez right? In the end, the whole point is to make urls more readable![/quote] I disagree with this in that URLs should always conform to RFC 1738 (see section 2.2). That means no accented characters and no spaces. This was updated recently to include Chinese characters, but still, don't go nuts. If you start using non-standard URLs, I guarantee that you will break something. Maybe not in your particular browser, but in some browser somewhere that actually adheres to the standards, you most certainly will. The whole point is not to make URLs more readable. That's what search engines and internal navigational elements are for. The whole point is to uniquely define page locations. If a URL gives the user some clue as to what they will find at that location, all the better. If they are discernable to the point where a user can guess the location of something based on its name, that's gravy, not a requirement. In the example you give, there's nothing particularly wrong with .../john_doe, but that means that the programmer is going to have to write his own my_urlencode() and my_urldecode() functions. It just seems like a waste to me when perfectly good, stable, tested a billion times ones already exist in the core php library. Writing your own is time and effort you can spend working on something else, it's one less thing you have to test and re-test, and it's one less point of failure that can break as you write and maintain your code. My consistent advice is don't reinvent wheels unless you have to, and prettifying URLs is generally not a "have to" reason. Having said all of that, if you absolutely, positively must have prettified URLs, use CodeIgniter's url_title() function. At least someone else has taken the time to write, test, and maintain it, which is less work for you. |
Messages In This Thread |
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 04:50 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 05:03 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 05:05 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 05:05 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 07:20 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 06:41 PM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 07:25 PM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 01:16 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 05:57 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 06:00 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 06:08 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 06:11 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 07:54 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 07:58 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 12:25 PM
URL Rewriting: Name instead of ID - by El Forum - 07-26-2010, 10:47 AM
|