url - 在 URL 中使用逗号有时会破坏 URL?

标签 url url-rewriting hyperlink seo

有人知道在 SEO 友好 URL 中使用逗号有什么问题吗?我正在使用一些在其 SEO 友好 URL 中使用大量逗号的软件;但我 100% 肯定我见过一些程序/平台无法正确识别 URL 并在第一个逗号后切断 URL 的“链接”的情况。

我刚刚在 SMF 论坛上用 thunderbird、gmail、hotmail 测试了这个,没有任何问题;但是我知道我以前见过这个问题。

所以我的问题是,是否有什么特别会导致某些平台停止使用逗号链接 URL?比如逗号后面的某个字符?

最佳答案

届时将有无数 实现来切断自动链接。与许多其他角色一样。但这不是使用这些字符的问题,而是因为错误/不完整的实现。

例如,请参见这个网站 Stack Overflow。手动输入/粘贴此 URL 时,它将切断 * 处的链接(see bug;如果问题得到修复,这里是 screenshot of it):

但是当使用超链接语法时,它工作正常:

HTTP URL 路径中允许使用 * 字符,因此链接检测应该识别第一个 URL,而不是在出现 * 时将其破坏


关于逗号:

逗号是reserved character其含义与 URL path 有关(大胆强调我的):

Aside from dot-segments in hierarchical paths, a path segment is considered opaque by the generic syntax. URI producing applications often use the reserved characters allowed in a segment to delimit scheme-specific or dereference-handler-specific subcomponents. For example, the semicolon (";") and equals ("=") reserved characters are often used to delimit parameters and parameter values applicable to that segment. The comma (",") reserved character is often used for similar purposes. For example, one URI producer might use a segment such as "name;v=1.1" to indicate a reference to version 1.1 of "name", whereas another might use a segment such as "name,1.1" to indicate the same.

因此,如果您不打算将逗号用作保留字符的函数,您可能需要使用 %2C 对其进行百分号编码。用户从浏览器的地址栏复制这样的 URL 会以编码形式粘贴它,因此它应该几乎可以在任何地方使用。

但是,特别是因为它是一个保留字符,未编码的形式也应该有效。

关于url - 在 URL 中使用逗号有时会破坏 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14663813/

相关文章:

url - 在 SEO 友好的 URL 中添加类别?

url-rewriting - 在 Yii2 中隐藏 URL 中的网页

url - SEO 和重复 URL

php - htaccess 重写 - 文件名无法识别

nginx - 条件重写,如何管理PHP脚本?

excel - 当超过 65,530 行时,EPPlus 损坏的 Excel 文件

jquery - 使用 jQuery 更改已访问链接的 CSS

Jquery - 内部有链接的 Div 和 jquery.click() 函数

c# - Windows 窗体文本框应该只接受 url 名称

javascript - URL 未在 webview 中加载但在 android 的浏览器中加载?