Possible Duplicate:
Best practices for URL with space and special characters
I’m trying to make “pretty” url, and i was wondering how do people deal with empty spaces, for example if I’m creating a new forum thread with a title:
awesome thread title
I would like to replace empty space with - symbol, so I should get something like:
http://website.com/forum/thread/awesome-thread-title
Now it seems to be working but what should i do if user wrote
some-title
This would break my code when fetching record from the database, because i would replace - symbol to empty space while row name in the database would actually have - therefore I wouldn’t find anything.
I could give even more examples…
You should not rely on the title part of the url to find the element in the database. Prepend it with some ID and ignore the title. Look at the url of the page you are currently viewing in stackoverflow…