0

Possible Duplicate:
How does StackOverflow generate its SEO-friendly URLs?

I have an MVC3 site for which I would like to clean up the urls that contain spaces in the names of the products.

Currently, the url displays as: /products/some%20ugly%20url

I would like to display: /products/some-clean-url

Is it possible with MVC3 routing to rewrite the ugly url to the clean one?

4

1 回答 1

2

Short answer: yes this is possible. Just look up. StackExchange runs on ASP.NET MVC.

Try creating a product slug. A slug is a unique string that identifies your item that you want to fetch.

/products/fake-blood
/products/spiders-webs
/products/vampire-teeth

You can then key off the slug, instead of an ID. Many solutions store the slug in the database.

于 2012-10-29T12:56:51.383 回答