/%year%/%postname%/
I added the following section to my web.config file.
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
After updating the web.config and browsing to one of my posts, I encounter the following IIS7 error:Cannot add duplicate collection entry of type 'rule' with unique key attribute 'name' set to 'wordpress'
When I’ve encountered this error in the past, it hasn’t been a direct problem with my web.config, but has been a problem with inherited sections or values from a parent website config or one of the default environment configurations. With that in mind, I added the following line to remove any existing rules with the name “wordpress” before trying to add my own.
<remove name="wordpress"/>
The complete web.config section looked like this and cleared up the error.
<rewrite>
<rules>
<remove name="wordpress"/>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
Hope this helps someone!
How are you sure the wordpress rule that you removed wasn't needed somewhere else though?
ReplyDeleteThank you!!! You are a genius. I was struggling with this same issue and this resolved it beautifully-- and now I think I understand WHY it was an issue, a little better!
ReplyDeleteHappy to have helped!
ReplyDeleteAre you changing this on the parent web.config file or the child?
ReplyDeleteAlso, I saw this online
Is this bascially the same thing?
Well that didn't display code so here is where I found a similar solution: http://www.geefamily.net/2010/08/22/wordpress-and-subdomains
ReplyDeleteThanks. That came in very handy.
ReplyDeleteMan, you rocks!
ReplyDeleteFinally I could run my site http://hectorea.com/blog
Thanks!
Awesome! Thanks for the help. Fixed problem.
ReplyDeleteThanks, that solved the problem :)
ReplyDeleteRegards form Colombia
thank you Genius, solved my problem like a boss. <3 from Pakistan
ReplyDelete<3 U!!
ReplyDeleteThank you! Great solution, everything appears to be working.
ReplyDeleteWorked for me, after an hour of trying to figure out how something as simple as changing a permalink could brake the whole site. Thanks.
ReplyDeleteThis was great advice, it pointed me in the right direction however my issue was I had the same rule duplicated, just had to delete the one
ReplyDelete