IIS 尾部斜杠规则不会从域的根目录中删除尾部斜杠

标签 iis seo url-rewrite-module

我正在使用“标准”删除尾部斜杠规则

<rule name="SEO - Remove trailing slash" stopProcessing="false">
  <match url="(.*)/$" />
  <conditions>
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  </conditions>
  <action type="Redirect" url="{R:1}" />
</rule>

这适用于站点上的所有 URL,除了根 www.mysite.com 附加至少一个尾部斜杠,并且 www.mysite.com////等 URL 也没有被处理(并使他们的进入搜索引擎)。我已经禁用了所有其他规则,但这种情况仍然存在。如何整理网站的根目录?

顺便说一下,IIS 管理控制台中的 TEST 按钮指示规则应该 起作用。它根本没有。

编辑: 进一步的研究显示了一篇来自谷歌的文章关于这个 http://googlewebmastercentral.blogspot.co.uk/2010/04/to-slash-or-not-to-slash.html “请放心,对于您的根 URL,http://example.com 等同于 http://example.com/,即使您是 Chuck Norris 也无法重定向。”,但是某些东西(可能是站外)导致///进入Google 索引,所以我正在寻找解决方法。

最佳答案

这似乎是不可能的,但是为了 SEO 目的 a

     <link rel="canonical" href="http://www.example.com" />

似乎有助于解决排名问题。

关于IIS 尾部斜杠规则不会从域的根目录中删除尾部斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25012906/

相关文章:

IIS7.5 : Is there a way to use Require SSL and URL Rewrite Module together for https?

java - 使用tomcat服务器在局域网上托管我的网站

php - 如果在 WordPress 中修改自 header

asp.net-mvc-3 - ASP.NET MVC 3 路由 : prevent ~/home access?

php - 重写 URL :s with . htaccess

url-rewriting - 使用 IIS URL 重写将子文件夹重定向到子域/子文件夹

iis - 如何使用 IIS7 URL 重写模块重定向到应用程序根目录?

iis - 用于分析 IIS Web 日志以进行故障排除的工具

c# - 尽管线程池中有足够的线程,但请求仍在 Azure AppService 中排队

iis - Azure 网站上的 503 错误(服务不可用)