views:

239

answers:

1

Hi, I see many sites that have address like this:

http://www.myblog/2008/10/10/articl-title.aspx

Question 1

If I am using linq2sql to pull the article it is obvious that i must search for article in db using Startwith() function, but is this really smart and precise over searching using the ID ?

Question 2 What is the best way to make the URL look neat like this and add the ID and make search engine friendly at the same time?

thanks in advance.

+4  A: 

Well, a very simple alternative is the trick that SO uses; include both the internal identifier and the search-friendly portion - i.e.

http://stackoverflow.com/questions/793908/what-is-the-best-practice-for-urlrewriting-a-blog-article-adress

just only look at the identifier. With ASP.NET MVC routes this is trivial.

If you go the other route (no db identifier in the route); simply store the mangled name/path in the db - then your query is an equality one = very efficient.

Marc Gravell
One issue with doing it this way is that anyone can change the URL text but it will still go to the correct content. This could lead to duplicate content and be treated poorly by search engines.
Joe Philllips
Personally, I do it like this on my websites because the PROs outweight the CONs
Joe Philllips
@d03boy, would making a query that match the ID and Startwith(article title) solve this ? is it efficient ?
@devmainia the SO url works withought the text portion. Trim it just after the number and then load that url...
Greg B