Wir sind jetzt auf LinkedIn: Folgen Sie uns auf LinkedIn, um Neuigkeiten und Ressourcen der Google Suche dazu zu erhalten, wie Sie Ihre Website auffindbar machen können.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Mittwoch, 21. April 2010
Diese Frage wird häufig gestellt. Die Antwort wollen wir nicht schuldig bleiben! Traditionell geben URLs mit abschließendem Schrägstrich häufig ein Verzeichnis an, während die ohne abschließenden Schrägstrich auf eine Datei hindeuten:
https://example.com/foo/ (with trailing slash, conventionally a directory)
https://example.com/foo (without trailing slash, conventionally a file)
Dies muss jedoch nicht unbedingt der Fall sein. Google behandelt die oben angegebenen URLs gleich, jedoch als separate URLs, und zwar unabhängig davon, ob es sich um eine Datei oder ein Verzeichnis handelt oder ob sie einen abschließenden Schrägstrich enthalten oder nicht.
Unterschiedlicher Content unter URLs mit und ohne Schrägstrich ist für Google in Ordnung, aber oft weniger ideal für Nutzer
Vom technischen Standpunkt bzw. dem der Suchmaschine aus gesehen, ist es durchaus zulässig, wenn diese beiden URL-Versionen unterschiedlichen Content aufweisen. Nutzer finden diese Konfiguration jedoch möglicherweise schrecklich verwirrend. Stellt euch nur vor, wie es wäre, wenn www.google.com/webmasters und www.google.com/webmasters/ zu unterschiedlichen Ergebnissen führen würden.
Aus diesem Grund führen URLs mit abschließendem Schrägstrich und solche ohne abschließenden Schrägstrich häufig zum selben Content. In den allermeisten Fällen ist eine Website mit einer Verzeichnisstruktur konfiguriert:
Wenn nur eine Version zurückgegeben werden kann (d. h., die andere leitet zur ihr weiter), ist das sehr gut so. Dieses Verhalten ist vorteilhaft, weil so weniger Duplicate Content entsteht. Bei Weiterleitungen zu URLs mit abschließendem Schrägstrich wird in unseren Suchergebnissen unabhängig davon, ob es sich um eine 301- oder 302-Weiterleitung handelt, wahrscheinlich die Version der URL mit dem Antwortcode 200 angezeigt. Meistens ist dies die URL mit abschließendem Schrägstrich.
Wenn die Versionen mit abschließendem Schrägstrich und ohne abschließenden Schrägstrich beide den gleichen Content enthalten und beide den Antwortcode 200 zurückgeben, habt ihr folgende Möglichkeiten:
Ihr könnt dieses Verhalten ändern (weitere Infos hierzu unten), damit Duplicate Content reduziert und die Crawling-Effizienz verbessert wird.
Ihr könnt es unverändert lassen. Viele Websites haben Duplicate Content. Unser Indexierungsprozess handhabt die URLs für Webmaster und Nutzer häufig entsprechend. Es ist zwar keine optimale Situation, aber absolut legitim und okay.
Insbesondere bei eurer Stamm-URL ist https://example.com mit https://example.com/ äquivalent und es kann selbst dann nicht weitergeleitet werden, wenn man Chuck Norris ist.
Sicherstellen, dass nur eine URL-Version angezeigt wird
Was also tun, falls eure Website für diese beiden URLs Duplicate Content anzeigt:
https://example.com/foo/
https://example.com/foo
also beide URLs den Statuscode 200 zurückgeben (keine hat eine Weiterleitung oder enthält ein rel="canonical"-Link-Tag) und ihr das ändern möchtet?
Wählt eine URL als bevorzugte Version. Wenn eure Website eine Verzeichnisstruktur hat, ist es üblicher, einen abschließenden Schrägstrich in euren Verzeichnis-URLs zu verwenden, z. B. example.com/directory/ statt example.com/directory. Es steht euch jedoch frei, euch anders zu entscheiden.
Seid konsequent im Umgang mit der bevorzugten Version. Verwendet sie in euren internen Links. Falls ihr eine Sitemap habt, verwendet für diese die bevorzugte Version und nicht ihr Gegenstück.
Verwendet eine 301-Weiterleitung von der duplizierten zu der bevorzugten Version. Sollte das nicht möglich sein, ist das Link-Tag rel="canonical" eine gute Option.
rel="canonical" funktioniert für die Indexierungszwecke von Google und anderen großen Suchmaschinen ähnlich wie 301.
Testet eure 301-Konfiguration in den Webmaster-Tools mit Abruf wie durch Googlebot.
Prüft, ob sich eure URLs, https://example.com/foo/ und https://example.com/foo, wie erwartet verhalten. Die bevorzugte Version sollte den Statuscode 200 zurückgeben. Die duplizierte URL sollte 301 zur bevorzugten URL weiterleiten.
Sucht in den Webmaster-Tools nach Crawling-Fehlern und prüft nach Möglichkeit auch in euren Webserverprotokollen, ob die 301-Weiterleitungen implementiert sind.
Profit! Nein, Spaß beiseite, ihr könnt euch jetzt beruhigt zurücklehnen in der Gewissheit, dass eure Serverkonfiguration effizient und eure Website optimiert ist.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],[],[[["\u003cp\u003eGoogle treats URLs with and without trailing slashes as distinct pages, regardless of their content.\u003c/p\u003e\n"],["\u003cp\u003eWhile Google can handle duplicate content on URLs with/without trailing slashes, it's better for users and SEO to consolidate to a single version.\u003c/p\u003e\n"],["\u003cp\u003eChoose a preferred URL version (with or without trailing slash) and 301 redirect the other version to it to avoid duplicate content issues.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003erel="canonical"\u003c/code\u003e link tag as an alternative to 301 redirects if redirects are not feasible for consolidating duplicate URLs.\u003c/p\u003e\n"],["\u003cp\u003eEnsure consistency in internal linking, sitemaps, and server configuration to support your preferred URL version for optimal crawling and indexing.\u003c/p\u003e\n"]]],["URLs with and without trailing slashes are treated separately by Google, regardless of their file or directory designation. Identical content on both versions is acceptable, but can cause user confusion and duplicate content issues. To resolve this, choose one URL style, use it consistently in internal links and sitemaps, and redirect the other version using a 301 redirect or rel=\"canonical\" tag. Verify this configuration with the `Fetch as Googlebot` and by checking web server logs for crawl errors.\n"],null,["# To slash or not to slash\n\nWednesday, April 21, 2010\n\n\nThat is the question we hear often. Onward to the answers! Historically, it's common for URLs with\na trailing slash to indicate a directory, and those without a trailing slash to denote a file: \n\n```\nhttps://example.com/foo/ (with trailing slash, conventionally a directory)\nhttps://example.com/foo (without trailing slash, conventionally a file)\n```\n\n\nBut they certainly don't have to. Google treats each URL above separately (and equally) regardless\nof whether it's a file or a directory, or it contains a trailing slash or it doesn't contain a\ntrailing slash.\n\nDifferent content on slash and non-slash URLs is okay for Google, but often is less ideal for users\n---------------------------------------------------------------------------------------------------\n\n\nFrom a technical, search engine standpoint, it's certainly permissible for these two URL versions\nto contain different content. Your users, however, may find this configuration horribly\nconfusing---just imagine if `www.google.com/webmasters` and\n`www.google.com/webmasters/` produced two separate experiences.\n\n\nFor this reason, trailing slash and non-trailing slash URLs often serve the same content. The most\ncommon case is when a site is configured with a directory structure: \n\n```\nhttps://example.com/parent-directory/child-directory/\n```\n\nYour site's configuration and your options\n------------------------------------------\n\n\nYou can do a quick check on your site to see if either of the URLs matching this pattern\n[redirects](/search/docs/crawling-indexing/301-redirects) to the other:\n\n1. `https://example.com/foo/` \n (with trailing slash)\n2. `https://example.com/foo` \n (no trailing slash)\n\n- If only one version can be returned (that is, the other redirects to it), that's great! This behavior is beneficial because it reduces [duplicate content](/search/docs/advanced/guidelines/duplicate-content). In the particular case of redirects to trailing slash URLs, our search results will likely show the version of the URL with the [`200` response code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) (most often the trailing slash URL)---regardless of whether the redirect was a `301` or `302`.\n- If both slash and non-trailing-slash versions contain the same content and each returns `200`, you can:\n - Consider changing this behavior (more info below) to reduce duplicate content and improve [crawl efficiency](/search/blog/2009/08/optimize-your-crawling-indexing).\n - Leave it as-is. Many sites have duplicate content. Our indexing process often handles this case for webmasters and users. While it's not totally optimal behavior, it's perfectly legitimate and a-okay. :)\n - Rest assured that for your root URL specifically, `https://example.com` is equivalent to `https://example.com/` and can't be redirected even if you're Chuck Norris.\n\nSteps for serving only one URL version\n--------------------------------------\n\nWhat if your site serves duplicate content on these two URLs: \n\n```\nhttps://example.com/foo/\nhttps://example.com/foo\n```\n\n\nMeaning that both URLs return `200` (neither has a redirect or contains\n[`rel=\"canonical\"` link tag](/search/docs/crawling-indexing/consolidate-duplicate-urls)\n), and you want to change the situation?\n\n1. Choose one URL as the preferred version. If your site has a directory structure, it's more conventional to use a trailing slash with your directory URLs (for example, `example.com/directory/` rather than `example.com/directory`), but you can choose whichever you like.\n2. Be consistent with the preferred version. Use it in your internal links. If you have a [sitemap](/search/docs/crawling-indexing/sitemaps/overview), include the preferred version (and don't include the duplicate URL).\n3. Use a `301` redirect from the duplicate to the preferred version. If that's not possible, the `rel=\"canonical\"` link tag is a strong option. `rel=\"canonical\"` works similarly to a `301` for Google's indexing purposes, and other major search engines as well.\n4. Test your `301` configuration through [Fetch as Googlebot](https://support.google.com/webmasters/answer/9128668) in [Webmaster Tools](https://search.google.com/search-console). Make sure your URLs, `https://example.com/foo/` and `https://example.com/foo`, are behaving as expected. The preferred version should return a `200` status code. The duplicate URL should `301` redirect to the preferred URL.\n5. Check for [Crawl errors](https://support.google.com/webmasters/answer/9679690) in Webmaster Tools, and, if possible, your webserver logs as a quick check that the `301` redirects are implemented.\n6. Profit! (just kidding) But you can bask in the sunshine of your efficient server configuration, warmed by the knowledge that your site is better optimized.\n\nWritten by [Maile Ohye](/search/blog/authors/maile-ohye), Developer Programs Tech Lead"]]