UGA Boxxx

つぶやきの延長のつもりで、知ったこと思ったこと書いてます

【SEO】末尾に「/」ありなしの違い

あるときトレイリングスラッシュと呼ばれるURL末尾の「/」のありなしが話題になったので調べた

結論気にしなくてよい

以下の記事を読むと、ありなしは気にする必要はがないことがわかった

www.suzukikenichi.com

サブディレクトリのありなしは意味が変わってくる(「/」なしならファイル名、ありならディレクトリ名)だが、ファイルがなければ「/」をつけてリダイレクトしてディレクトリを探すからとのこと

ただ、リダイレクトをする前提で話されているので、していない場合はしておいた方がよさそう

ましてや、ありなしで表示されるものが変わる等いうのは直すべき(スラッシュなしだと404ページになるなど)

RFC3986にもこの辺りのことが書かれていた

https://www.ietf.org/rfc/rfc3986.txt

6.2.4. Protocol-Based Normalization

Substantial effort to reduce the incidence of false negatives is often cost-effective for web spiders. Therefore, they implement even more aggressive techniques in URI comparison. For example, if they observe that a URI such as

  http://example.com/data

redirects to a URI differing only in the trailing slash

  http://example.com/data/

they will likely regard the two as equivalent in the future. This kind of technique is only appropriate when equivalence is clearly indicated by both the result of accessing the resources and the common conventions of their scheme's dereference algorithm (in this case, use of redirection by HTTP origin servers to avoid problems with relative references).