Here are some suggestions for using URLs:
- It is best to visually see the meaning of the URL, and do not define the URL with specific information about the application. For example, using/articles/report is better than using/website_v2/cachedcontentserver/fromcache/report.
- Using a content title is better than using an ID. For example, using/articles/annualreport is better than using/articles/2392. If you must use an ID (such as sometimes you might need to distinguish the same title), then both are used, such as/articles/2392/annualreport, which looks very long, but more user friendly, and more conducive to SEO.
- Do not use a file name extension (such as. aspx or. mvc) for Web pages. However, for special files, use extensions (such as. jpg,. pdf,. zip, and so on).
- Use the URL of a hierarchical relationship, such as/products/menswear/shirts/red, whenever possible, so that users can guess the parent URL.
- Case-insensitive, so user-friendly input.
- Use Get and post correctly. Get is typically used to get read-only information from the server, and post is used when an action is required to change state.
- Avoid using marker symbols, code, character sequences, and so on whenever possible. If you want to delimit with a marker, use an underscore (such as/my-great-article), the underscore is unfriendly, and the space and + numbers are encoded by the URL.
- Don't change URLs easily, especially for Internet sites. If you must change it, keep the original URL as long as possible.
- Try to get URLs to use a uniform style or habit.
MVC URL Definition Recommendations