我已经创建了将非 www 重定向到 www、/index.html 到“/”、404 到自定义页面的代码,我正在使用 IIS 服务器并将此代码放在 web.config 文件中,看看,它工作正常。但我想知道它对 SEO 有好处吗?或者它需要任何修改?
谢谢
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1" stopProcessing="true">
<match url="index\.html(?:l)?" />
<conditions>
<add input="{HTTP_HOST}" pattern="example\.com.au$" />
</conditions>
<action type="Redirect" url="http://www.example.com.au/" />
</rule>
<rule name="CanonicalHostNameRule2" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example\.com.au$" />
</conditions>
<action type="Redirect" url="http://www.example.com.au/{R:1}" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/404error.html" />
</httpErrors>
</system.webServer>
</configuration>