Redirect or Rewrite to Remove Double or Multiple Slashes (//) in URL重定向或重写,以消除双重或多重斜线( / / )在网址

Google search engine spider or crawler Googlebot is one of the most advanced and finest content grabber that extracts most if not all of any data of the Internet and World Wide Web, regardless of whether such contents or web pages are intended for public visitors. Google搜寻引擎蜘蛛或履带Googlebot是其中一个最先进和最优秀的内容采集提取最如果不是所有的任何数据,互联网和万维网,不论这些内容或网页供公众参观。

As such, some webmasters may notice that Google is crawling and indexing web pages which are not supposed to be existed in the first place.因此,有些网站管理员可能会注意到, Google是抓取并编制索引的网页,这是不应该存在,摆在首位。 One such instance is incorrect and wrong URL link location, such as when double slash, triple slash or multiple forward slashes been formed as part of the URL as extra slash or slashes been appended or added to the web page URLs.这样一个实例是不正确和错误的URL连结位置,例如当双斜线,三重斜线或多个正斜线已形成了部分的URL作为额外的斜线或斜线被附加或添加到网页的网址。 For example, a page with URL of http://www.domain.com/index.php is also been crawled by Google as http://www.domain.com//index.php, or sometimes even http://www.domain.com///index.php.举例来说,一个网页的网址http://www.domain.com/index.php也是被Google检索作为http://www.domain.com//index.php ,或有时甚至的http:// www.domain.com///index.php 。

The web crawl and spider indexing by Google can be tracked and traced in Apache or web server access logs.网页蜘蛛抓取和索引由Google可以跟踪和追查,在Apache或Web服务器的访问日志。 And these double slash, triple slash, quadruple or more slash URLs can show up in the Google search results, and potentially can cause duplicate content issue , and worse, penalty that makes the site vanishing from Google search results listing or been pushed into supplemental results with low ranking.这些双斜线,三重斜线,四倍或以上的斜线的URL都可以显示在Google搜索结果中,而且可能会造成重复的内容问题,更糟的是,罚款,使网站消失从Google搜索结果中上市或已被推入补充结果低的排名。

The reason for additional slashes in the URL is unknown, and seems like it only happens on Google search engne.原因是额外的斜线在URL中是未知的,好像只发生在Google搜寻engne 。 One possibility is visitors or other websites type or put incorrect backlink (external link), which picked up by ultra-sensitive一种可能性是访客或其他网站的类型或提出不正确反向(外部链接) ,其中拾起由超敏感 Googlebot or Mediapartners-Google Googlebot的或mediapartners Google的 (Google AdSense crawler which also contribute website indexing of Google Search). ( Google AdSense的履带,其中也有助于网站索引的Google搜寻) 。 But one thing is for sure - when one page with wrongful double or a few adjacent slashes been indexed, entire web pages within the website may be prone to such error too.但有一件事是肯定的-当一个网页与不法行为的双重或几个毗邻的斜线被索引,整个网页内的网址可能会容易受到这种错误太多。

To fix and resolve the double slash or multiple slash URLs issue is pretty simple.修复和解决双斜线或多重斜线网址的问题是很简单。 Simply create a mod_rewrite directive in .htaccess code or Apache httpd.conf configuration file to rewrite or redirect permanently (status 301) all URL found to be contained two or more adjacent or trailing slashes to its proper and valid URL with just a single slash (/) instead or // or /// or even //// or more within the URL address, create a .htaccess file in the root directory (normally public_html) for the website with the following URL rewriting and redirection directive (if .htaccess already exists, just add in the code on top).只要创建一个mod_rewrite指令在。 htaccess的代码或Apache的httpd.conf配置文件重写或重定向永久(地位301 )所有的网址,发现载两个或两个以上的毗邻或尾端斜线其适当和有效的URL ,只要一个单一的斜线( / ) ,而不是和/或/或/ / /或什至/ / / /或以上, URL地址,创建一个。 htaccess的文件在根目录(通常public_html )的网站上与下面的URL重写和重定向的指令(如。 htaccess的已经存在,只是添加在代码中对顶端) 。

# Remove multiple slashes anywhere in URL #删除多个斜线的任何地方网址
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ rewritecond % ( request_uri ) ^(.*)//(.*)$
RewriteRule . rewriterule 。 %1/%2 [R=301,L] % 1 / % 2 [ r = 301 ,]

The above redirection or URL rewrite method will parse the complete URL section on the part after the domain name, and will change each part of double slash to single slash (and thus able to handle more than 2 slashes in URL too).上述重定向或网址重写方法将解析完整的URL一节以后的部分域名,并会改变的每一部分,双斜线,以单一的斜线(从而能够处理超过2斜线在太长) 。 For administrators who want to more efficient rewrite command, use the following code, which can only be used on .htaccess file.为管理员谁想要更有效地重写命令,使用下面的代码,只能用于对。 htaccess的文件。

# Remove multiple slashes after domain #删除多个斜线后,网域
RewriteRule ^/(.*)$ http://www.domain.com/$1 [R=301,L] rewriterule ^/(.*)$ http://www.domain.com/ $ 1 [ r = 301 ,]

Replace domain name accordingly.取代的网域名称。

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article原来的英语文章 whenever possible.只要有可能。

Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 .



2 Responses to “Redirect or Rewrite to Remove Double or Multiple Slashes (//) in URL” 2回应“重定向或重写,以消除双重或多重斜线( / / )在网址”

  1. Tiger SEO徐老虎
    July 29th, 2008 19:33 2008年7月29日19时33分
    1

    Thanks a lot, a friend ask me how to remove that and we find the solution here感谢了很多,一位朋友问我如何删除,以及我们找到解决办法在这里 : )

  2. jeffb
    August 18th, 2008 03:00 2008年8月18日03:00
    2

    I am sorry but this causes trouble with IE 8 web slicing by breaking it, and only works in the root directory.我很抱歉,但这个麻烦的原因与即8网页切片突破,只有在工程的根目录。

    All sub directory listings will get triple slashes and expose server side includes, from the new perl hacks available.所有分目录列表,将获得三重斜线和揭露服务器端包括,由新的Perl黑客可用。

    Warning:警告:

    If you use any password protected logins, do not include this in your htaccess mod rewrite.如果您使用任何密码保护的登录信息,不包括在您的htaccess的按付款当日价格计算重写。

Leave a Reply离开的答复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用这些标签:的<a href="" title=""> <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> <删除日期时间= “ ” >的<em>的<i> <q cite=""> <strike>的<strong>

Subscribe without commenting订阅无评论


Custom Search

New Articles新的条款,

Incoming Search Terms for the Article传入的搜索条件文章

mydigitallife double slash mydigitallife双斜线 - - apache multiple forward slash //// 阿帕奇多个斜线/ / / / - - Rewrite redirect 重写重定向 - - rewrite double slash 重写双斜线 - - redirect rewrite 重定向重写 - - redirect remove trailing slash 重定向删除斜线 - - double slashes in url 双斜线在网址 - - duplicate slash in URL remove 重复的斜线网址删除 - - mod_rewrite double-slash mod_rewrite双斜线 - - htaccess double slashes htaccess的双斜线 - - htaccess redirect from double directory htaccess的重定向由双目录 - - htaccess remove double slashes htaccess的删除双斜线 - - apache rewrite redirect double slashes 阿帕奇重写重定向双斜线 - - mod_rewrite double slash mod_rewrite双斜线 - - multiple url rewrite htaccess 多个网址重写htaccess的 - - mod rewrite double slash 按付款当日价格计算重写双斜线 - - php strip forward slashes PHP中带正斜线 - - php remove forward slashes PHP中删除正斜线 - - extra slash in URL 额外的斜线网址 - - rewrite remove slashes 重写删除斜线 - - htaccess redirect slash htaccess的重定向斜线 - - double slash in url 双斜线在网址 - - forward url with double slash to url with single slash 前进的网址与双斜线的网址与单斜线 - - apache rewrite multiple trailing slashes 阿帕奇重写多个尾端斜线 - - htaccess remove slashes htaccess的删除斜线 - - htaccess remove trailing slash htaccess的删除斜线 - - url with more than a slash 网址以上的斜线 - - mod_rewrite multiple slashes mod_rewrite多个斜线 - - remove double slashes 删除双斜线 - - Slashes in URL 斜线在网址 - - htaccess remove exe from url htaccess的删除的EXE从以下网址 - - apache redirect strip trailing slash 阿帕奇重定向带斜线 - - how to remove the last slash in url using apache 如何删除最后的斜线网址使用Apache - - php remove forward slash PHP中删除斜线 - - mod rewrite remove double slashes 按付款当日价格计算重写删除双斜线 - - apache double slash 阿帕奇双斜线 - - rewrite remove double slash 重写删除双斜线 - - apache rewrite slash multi 阿帕奇重写斜线多 - - php strip multiple slashes PHP的带多重斜线 - - redirect "//" double slash 重定向“ / / ”双斜线 - - rewrite address bar 重写地址栏 - - .htaccess redirect multiple pages 。 htaccess的重定向多个页面 - - duplicate content redirect index.php?a 重复的内容重定向的index.php吗? - - htaccess Remove trailing slash at the end htaccess的删除斜线在年底 - - php replace double slash with slash PHP中取代双斜线与斜线 - - redirect change directory url remove 重定向改变目录网址删除 - - remove url address on redirect 删除的URL地址就重定向 - - rewrite / redirect 重写/重定向 - - site:http:// / inurl: Leave a Comment Name : Email : Url: Notify me of followup comments via e-mail 网站网址: http:// /在[ inurl :离开a comment姓名:电子邮件:网址:通知我跟进名词form; follow-up形容词形式的评论通过电子邮件 - - apache2 redirect ends up with two slashes Apache2中重定向两端与两个斜线 - -