II7.5 : error in web.config when I try to write rewrite rules condition

1

I have shared hosting server which runs IIS 7.5 .

I wrote this code in web.config.

<system.webServer>
    <rewrite>
        <rules>
            <rule name="AddWWWprefix" >
                <match url="(.*)" ignoreCase="true" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^abc\.com" />
                </conditions>
                <action type="Redirect" url="http://www.abc.com/{R:1}" redirectType="Permanent" />
            </rule>

            <rule name="RemoveWWWprefix" >
                <match url="(.*)" ignoreCase="true" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^www\.abc\.com" />
                </conditions>
                <action type="Redirect" url="http://abc.com/{R:1}" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

And I am getting following error.

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid

error code : Error Code 0x8007000d

Config Source -1: 0:

I know it could some small error. Can anybody help me out? Thanks.

iis-7
url-rewriting
web-config
rewrite
iis-7.5
asked on Stack Overflow Aug 16, 2011 by Vikrant Shitole • edited Aug 16, 2011 by Vikrant Shitole

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0