/%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!
14 comments:
How are you sure the wordpress rule that you removed wasn't needed somewhere else though?
Thank 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!
Happy to have helped!
Are you changing this on the parent web.config file or the child?
Also, 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
Thanks. That came in very handy.
Man, you rocks!
Finally I could run my site http://hectorea.com/blog
Thanks!
Awesome! Thanks for the help. Fixed problem.
Thanks, that solved the problem :)
Regards form Colombia
thank you Genius, solved my problem like a boss. <3 from Pakistan
<3 U!!
Thank you! Great solution, everything appears to be working.
Worked for me, after an hour of trying to figure out how something as simple as changing a permalink could brake the whole site. Thanks.
This 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
Post a Comment