Welcome to WebmasterWorld Guest from 54.205.119.93

Forum Moderators: ocean10000

Message Too Old, No Replies

IIS Rewrite canconical

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

10+ Year Member



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)

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



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)

10+ Year Member



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

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



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

Featured Threads

Hot Threads This Week

Hot Threads This Month