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中重定向兩端與兩個斜線 - -