有关 MVC 应用程序有意义的 URL 格式的建议
我正在尝试为我的应用程序决定有意义的 URL(以跟踪应用程序版本)。该网站非常简单:我的第一个屏幕列出了应用程序。单击某个应用程序会将您带到该应用程序的版本。单击某个版本后,您将看到该版本的注释。
所以,我最初在想:
~/applications
~/releases?applicationid=34
~/notes?releaseid=290
我也在想这个:
~/applications
~/application-name/releases
~/application-name/release-number/notes
后一种方法的挑战是应用程序名称可以有空格,这意味着我必须在准备 URL 时转换为连字符,然后在读取 URL 时转换回空格。
一般来说,推荐哪种款式?
谢谢
I'm trying to decide on meaningful URLs for my application (to track application releases). The site is pretty simple: My first screen lists applications. Clicking on an application takes you to releases for that application. Clicking on a release then takes you to notes for that release.
So, I was initially thinking:
~/applications
~/releases?applicationid=34
~/notes?releaseid=290
I was also thinking of this:
~/applications
~/application-name/releases
~/application-name/release-number/notes
The challenge with the latter approach is that application-name can have spaces which means I have to convert to hyphens when preparing the URL and then convert back to spaces when reading the URL.
Generally speaking, which style is recommended?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何设置实际上只是根据您的情况而定的个人偏好。我可以想到在几种情况下您可能需要仔细考虑这一点:网络服务和 SEO 友好的 URL。
How you set this up is really just personal preference in your situation. There are a couple situations that I can think of where you might want to think carefully about this, web services and SEO friendly URLS.