homepage Welcome to WebmasterWorld Guest from 174.129.163.183
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
IIS Rewrite canconical
stevelibby




msg:4420410
 9:43 am on Feb 22, 2012 (gmt 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?

 

g1smd




msg:4420665
 9:43 pm on Feb 22, 2012 (gmt 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.

stevelibby




msg:4420672
 10:25 pm on Feb 22, 2012 (gmt 0)

I moved it to the top of the rules list and it works now.

g1smd




msg:4420673
 10:32 pm on Feb 22, 2012 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved