Domanda

I'm using the "standard" remove trailing slash rule

<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>

this works fine for all URL's on the site except the root www.mysite.com which appends at least one trailing slash, and URLs such as www.mysite.com//// are also not dealt with (and making their way into search engines). I've disabled all other rules, and this still occurs. How do I tidy up the root of the site?

Incidentally the TEST button in the IIS management console indicates that the rule should work. It simply doesn't.

EDIT: Further research shows an article from Google on this http://googlewebmastercentral.blogspot.co.uk/2010/04/to-slash-or-not-to-slash.html "Rest assured that for your root URL specifically, http://example.com is equivalent to http://example.com/ and can’t be redirected even if you’re Chuck Norris.", but something (probably off site) is causing /// to get into Google index so I'm looking for a way around it.

È stato utile?

Soluzione

It appears that its not possible to do this, however for SEO purposes a

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

seems to help resolve the ranking issue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top