简体   繁体   中英

What is the best practice for URL rewriting a Blog Article Address?

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM