While working on a WordPress project, one of the requirements was to keep an existing web application in ASP.NET which also meant that this would be on a Windows server. No big whoop, right? Here is something I learned…
The rewrite rules for WordPress in the web.config can interfere with calling the WebResource.axd and ScriptResource.axd. The problem is they show up as 404 errors when called via the ASP.NET app.
The fix was to modify the rewrite rules as follows…
|
1 2 3 4 5 6 7 8 |
<rule name="wordpress" patternSyntax="ECMAScript"> <match url=".*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{URL}" negate="true" pattern="\.axd$" /> </conditions> <action type="Rewrite" url="index.php" /> |
The difference is changing the patternSyntax from WildCard to ECMAScript and adding the pattern for .axd.
Hi, this is the only post I could find of this issue, I’m in the same boat, have to keep an asp.net site running with wordpress. I’m using wordpress 3.3.1 and I’m noticing the wordpress rewrite rules are messing with the .net app being able to find the WebResource.axd on my site. The following link which is created dynamically in my .net app returns a 404 when I have the wordpress rewrite rules active.
<br /> WebResource.axd?d=PQkxjE-M5Qm8oTdmrs5VXIbiMce3MiBo9wMIzWEesTaF-Gd5-WllTvIrt8AJ3rl9vgtmGFYSEfaNkXlf1ND8mHEI9jM1&t=634604821351482412<br />I think the wordpress rewrite rules have changed since your post (please see mine below). I’m guessing I need to edit wordpress rule 4. I tried adding the below to wordpress rule 4 , but no luck.
Thanks very much for any help!!
</p> <p>The issue for me was also on WP 3.3.1. The above code snippet is what worked for me. Replacing your rewrite riles in the web.config with the above did not work? What do you have for your rules?
for some reason my post was stripped of the rules, my rules are slightly different to yours, I will try again
Not sure whats up yet… but you can use pre tags instead of code tags.
how do you post code here? the using the “code” tag does not work for me
I have 7 wordpress rewrite rules, I have also asked for help on the IIS forum, here is a link to my post there:
http://forums.iis.net/p/1172016/2016922.aspx#2016922
it’s the last post on the page (sirg)
Thanks!
If you have not tried… try removing what you have for 4 and replace with what I have and see where that gets ya.
Thanks, I’ll give it a try tomorrow and let you know how it goes
The only thing I think might not work is the
because the url does not end with .axd , it is for example :
WebResource.axd?d=PQkxjE-M5Qm8oTdmrs5VXIbiMce3MiBo9wMIzWEesTaF-Gd5-WllTvIrt8AJ3rl9vgtmGFYSEfaNkXlf1ND8mHEI9jM1&t=634604821351482412
but I will try!
oh well, pre tag doesn’t work for me here either! :-/ I meant the part : pattern=”\.axd$”
I have now solved this. So for anyone wanting to run wordpress 3.3.1 multisite with an asp.net site together you just need to add the following to wordpress rewrite rule 4.
so the resulting rewrite rule looks like this: