Welcome to WebmasterWorld Guest from 50.19.190.144

Forum Moderators: ocean10000

Message Too Old, No Replies

IIS Rewrite canconical

     
9:43 am on Feb 22, 2012 (gmt 0)

Preferred Member from GB 

10+ Year Member

joined:Jan 26, 2004
posts: 636
votes: 0


I am trying to put the canconical tag in my .config which

<rule name="Enforce canonical hostname" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^www\.web/site\.co.uk$" />
</conditions>
<action type="Redirect" url="http://www.web/site.co.uk/{R:1}" redirectType="Permanent" />
</rule>

This works a treat on the home page, however on deeper pages where you want it to return /some-page/10 it returns id=10&title=some-page

is there something i have done wrong?
9:43 pm on Feb 22, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Sounds like an external redirect is happening after an internal rewrite. This exposes the already rewritten pointer as a new URL.

Rules should be the other way round. Redirect then rewrite.
10:25 pm on Feb 22, 2012 (gmt 0)

Preferred Member from GB 

10+ Year Member

joined:Jan 26, 2004
posts: 636
votes: 0


I moved it to the top of the rules list and it works now.
10:32 pm on Feb 22, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Cool. It does work the same as the Apache version then!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members