Having made a number of sites, and written a stack-load of PHP code, I still could not find a solution on the web for creating search engine friendly urls for user generated content. Here's what I ended up doing.
3 Comments
3 Comments



Comments
Do you find duplicate URLs to be a problem (not duplicate content)?
For example, what if someone posted a "part 2"?
I would recommend using a number as the primary key rather than the title and I don't think it's harmful to have a number in the URL.
You could end up with something like:
www.example.com/4/grey-line-right-wrong-politics-view.html
www.example.com/24/grey-line-right-wrong-politics-view.html
That would let you cope with two unique articles that just happened to have titles that truncated in the same way.
The other advantage to this approach is that if you start your primary ID at 100 then you'll always have an unique three digit number in your URL. That's one of the 'should-have' tick boxes if you want to get into Google News.
Any problems with this approach? Sure. Don't let the number get too long. You don't want to end up looking like a session. However, with ISBN numbers now at 13 characters in length and sessions generally being a lot longer - you're fairly safe!
Thanks for your comment Andrew (and sorry it's taken so long to reply) - you make some good points. Indeed, there are a few limitations with using this approach.
To be frank, I don't think numbers in urls (or for that matter stop words) to be a major issue. However, I imagine that having simple text urls might help SEO in some way, however small. I'm guessing but I also think that there may be usability benefits with simpler urls - they're easier to read and are more recognisable. This might help increase trust and click-through rates.
Having said that, I agree that duplication of urls is an issue so some sort of solution for that would be necessary, and the point about Google News is interesting.
Thanks. :-)
Friendly URLs used by some forums retain the thread number in the URL. That way you need never worry about duplicate titles, nor repetition of the numbers.