URL中的特殊字符 [英] Special Characters in URL

查看:111
本文介绍了URL中的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们当前正在用连字符(-)替换URL中的所有特殊字符和空格.从SEO和可读性的角度来看,这很好.但是,在某些情况下,在去除连字符后,我们会将部分URL输入到搜索中.当搜索词应该带有连字符时,就会出现问题,因为当它们被剥离时,它不会返回任何结果.我们可以修改我们正在使用的搜索算法,但这会减慢它的速度(尤其是糟糕的,因为我们将其与AJAX版本的搜索框一起使用,并且需要快速).

We're currently replacing all special characters and spaces in our URLs with hypens (-). From an SEO and readability point-of-view this works fine. However, in some cases, we are feeding parts of the URL into a search after stripping the hyphens out. The problem occurs when the search term should have hyphens as it returns no results when they get stripped. We could modify the search algorithm we're using but this will slow it down (especially bad as we're using it with an AJAX-ed search box and this needs to be fast).

据我们所知,处理此问题的最佳选择是用竖线(|)替换现有的连字符.我觉得这会对这些术语的SEO产生负面影响,因为竖线字符将被视为单词的一部分而不是分隔符.据我所知,被认为是分隔符的 only 字符是连字符和正斜杠(/).

The best option to deal with this, as far as we can tell is to replace pre-existing hyphens with pipes (|). I have a feeling that this will have a negative impact on SEO for those terms as the pipe character will be treated as a part of the word and not as a separator. As far as I can tell, the only characters that are considered to be separators are hyphens and forward slashes (/).

所以我的问题是:

  1. 是否可以使用其他字符来表示连字符?
  2. 如果我们不能使用其他任何字符,那么使用竖线字符会对搜索引擎产生多少影响?

干杯, 扎克

推荐答案

会〜(波浪号)工作?

Google现在将下划线和破折号视为单词分隔符因此您可以将破折​​号用作破折号,将下划线用作空格.

Google now treats underscores and dashes as word separators so you can use dashes as dashes and underscores as spaces.

这篇关于URL中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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