干净的 URL 是后端还是前端 [英] Are clean URLs a backend or a frontend thing

查看:23
本文介绍了干净的 URL 是后端还是前端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您认为.. 干净的 URL 是后端还是前端的纪律"

What do you think.. are clean URLs a backend or frontend 'discipline'

推荐答案

如果我们从最终用户体验中谈论 url 是干净的",那么我将打破常规并说 url 通常是不直观,它们永远不会,它们旨在机器可读.

If we're talking url's being 'clean' from an end user experience then I'm going to break the mould a bit and say that url's in general are not intuitive and they never will be, they are intended to be machine readable.

url 的格式没有标准,因此当从一个站点导航到另一个站点时,人类永远不会记得如何仅通过记住 url 及其友好语法"来访问资源.我们可以争论是否使用?"和'&'或 '/' 表示如何通过 url 识别资源;一种方法比另一种更好吗?没关系.在一天结束时,机器会解析它并发回结果.

There is no standard to the format of a url such that when navigating from site to site humans will never ever remember how to reach a resource purely through remembering urls and their 'friendly syntax'. We can argue the toss about whether using a '?' and '&' or '/' to express how how to identify a resource via a url; is one method better than the other? it doesn't matter. At the end of the day a machine parses it and sends back the result.

我们应该停止自欺欺人,认为这些东西实际上是人们输入的,并意识到 uri 是针对机器的,而不是针对人的.

We should stop deluding ourselves that people actually type these things in and realise that uri's are for machines, not people.

我还没有使用/记住超出 http://domain.com/的前几个字符的 uri 地址的一部分,我已经使用网络很久了.这就是书签的用途.网站上的任何地方都没有说在我们的 url 中更改此部分以查看'其他'资源",因为 url 通常是无证和不透明的.

I have yet to use/remember a uri that goes beyond the first few characters of the http://domain.com/ part of an address, and I've been using the web since a long time. That's what bookmarks are for. Nowhere on a website does it say 'change this part here in our url to view 'whatever else' resource' because url's are usually undocumented and opaque.

是的,让您的 uri 的 SEO 友好(即使它们会定期更改)但忘记整个人类/清洁"资源标识符的事情,这是一个神秘的白日梦.

Yes make your uri's SEO friendly (hell even they change periodically) but forget about the whole 'human/clean' resource identifier thing, it's a mystical pipe dream.

我同意 Vlion 的观点,即 url 应该提供一种独特的机制来为资源添加书签并返回到它(与这些可恶的 web 2.0 ajax/silverlight/flash 创作中的一些不同),但书签永远不会被人类理解和理解.似乎有相当多的注意力和精力花在构思人类可以记住和输入的 url 策略上,这是浪费精力.让我们继续解决实际问题.

I agree with Vlion that url's should provide a unique mechanism to bookmark a resource and return to it (unlike some of these abominable web 2.0 ajax/silverlight/flash creations), but the bookmark will never be for humans to comprehend and understand. There seems to be quite a lot of preoccupation and energy spent in dreaming up url strategies that humans can remember and type in, it's a waste of energy. Let's get on and solve real problems.

很抱歉,我很抱歉,但在某些圈子里有很多与 url 相关的 web 2.0 废话,完全是浪费时间.

Sorry for the rant, but there's a lot of web 2.0 nonsense related to urls going on in certain circles that are just a total waste of time.

这篇关于干净的 URL 是后端还是前端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆