我应该在 URL 中使用重音字符吗? [英] Should I use accented characters in URLs?
问题描述
当人们用不同于英语的语言创建网络内容时,搜索引擎优化和用户友好 URL 的问题就会出现.
When one creates web content in languages different than English the problem of search engine optimized and user friendly URLs emerge.
我想知道在 URL 中使用去重音的字母是否是最佳实践——冒着某些词在有和没有特定重音的情况下具有完全不同的含义的风险——或者最好坚持使用非-在不太先进的环境(例如 MSIE、查看源代码)中,适当地牺牲这些 URL 的可读性的英文字符.
I'm wondering whether it is the best practice to use de-accented letters in URLs -- risking that some words have completely different meanings with and without certain accents -- or it is better to stick to the usage of non-english characters where appropriate sacrificing the readability of those URLs in less advanced environments (e.g. MSIE, view source).
异国情调"字母可以出现在任何地方:文档标题、标签、用户名等,因此它们并不总是处于网站维护者的完全监督之下.
"Exotic" letters could appear anywhere: in titles of documents, in tags, in user names, etc, so they're not always under the complete supervision of the maintainer of the website.
当然,一种可能的方法是设置备用的 -- 无重音 -- URL 指向原始目标,但我想了解您对使用带重音的 URL 作为主要的看法文档标识符.
A possible approach of course would be setting up alternate -- unaccented -- URLs as well which would point to the original destination, but I would like to learn your opinions about using accented URLs as primary document identifiers.
推荐答案
当遇到类似的问题时,我利用了URL 重写 以允许通过重音或非重音字符访问此类页面.实际的 URL 类似于
When faced with a similar problem, I took advantage of URL rewriting to allow such pages to be accessible by either the accented or unaccented character. The actual URL would be something like
http://www.mysite.com/myresume.html
并且重写+字符翻译功能允许此引用
And a rewriting+character translating function allows this reference
http://www.mysite.com/myresumé.html
加载相同的资源.因此,为了回答您的问题,作为主要资源标识符,我将自己限制在 0-9、A-Z、a-z 和偶尔使用的连字符.
to load the same resource. So to answer your question, as the primary resource identifier, I confine myself to 0-9, A-Z, a-z and the occasional hyphen.
这篇关于我应该在 URL 中使用重音字符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!