MVC3 + WordPress IIS URL重写规则

编程入门 行业动态 更新时间:2024-10-10 06:19:47
本文介绍了MVC3 + WordPress IIS URL重写规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个位于 mydomain/mymvcapp/ 的ASP.NET MVC3网站。但是,webiste的根目录(mydomain)包含一个运行PHP的WordPress站点。因此,我提出了以下IIS URL重写规则,以允许WordPress通过其重写机制正常运行:

I have a ASP.NET MVC3 website located at mydomain/mymvcapp/. However, the root of the webiste (mydomain) contains a WordPress site running PHP. Therefore, I put the following IIS URL Rewrite rule to allow WordPress to function correctly via its rewriting mechanisms:

<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>

因此,根据此规则,我的WordPress功能完美,但是,我的MVC重写不起作用。如何更改此规则以允许WordPress和MVC(在/ mymvcapp /文件夹下)很好地共存?

So with this rule in place my WordPress functions perfectly, however, my MVC rewriting does NOT work. How would I alter this rule to allow both WordPress and MVC (under the /mymvcapp/ folder) to coexist nicely?

推荐答案

图我独自一人。正则表达式可能是最强大的YET复杂/混乱技术之一。但在这种情况下,patternSyntax标志设置为Wildcard,而不是Regex,这引起了我的困惑。希望这有助于其他人! =]

Figured it out on my own. Regex is probably one of the most powerful YET complicated / confusing technologies there is. But in this case the patternSyntax flag was set to Wildcard, not Regex, which caused my confusion. Hope this helps someone else out there! =]

<rewrite> <rules> <rule name="wordpress" patternSyntax="Wildcard"> <match url="*" /> <conditions logicalGrouping="MatchAll"> <add input="{PATH_INFO}" pattern="/mymvcapp/*" negate="true" /> <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>

更多推荐

MVC3 + WordPress IIS URL重写规则

本文发布于:2023-11-01 11:16:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549189.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   规则   WordPress   URL   IIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!