我使用以下 rewrtie 规则强制访问者在我的网站中使用 HTTPS。 SEO 检查工具将此重定向标记为负 SEO 参数。我应该如何设置 200 状态代码以重定向到 HTTPS 或者有其他方式而不是重定向?
<rule name="HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" negate="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
</conditions>
<action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" />
</rule>
这是来自 sitechecker.pro 的示例报告:
Page status code: 301 > 200
The content and destination URL should deliver the desired experience when clicked. Web crawlers can block pages that use redirects.
We recommend you promote a page with the 200 status code.
最佳答案
我没有发现您的重写有任何问题。您的“seo 工具”返回的响应似乎表明您要求它扫描 http://example.com
?如果是这种情况,那是一个合理/预期的结果(并且不是问题,因为 http 不是您网站的首选 url)。如果您使用 HTTPS 网址 https://example.com
我希望您的网站会返回 200 OK
响应 - 这应该满足您的 seo 工具?
从 http 重定向到 https 或以其他方式强制执行单个规范 url(即有或没有 www/全部小写等)是一个很好的 seo 实践。
重定向对您的主要 url https://example.com
上的 seo 不利,因为它们会导致额外的请求,从而延迟页面加载(例如,从 https://example.com 重定向/
到 https://example.com/home
应该避免)爬虫在某些情况下可能不喜欢重定向,因为它们可以用于“黑帽”seo 实践。
关于iis - 301 重写规则导致 SEO 警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51222122/