我有一个使用asp.net和wordpress的网站。wordpress组件位于一个名为wordpress的子目录中。它使用固定链接。
我还有一个asp.net站点,它使用站点根目录作为顶级目录。
asp.net站点使用了一些重写规则,因此我可以在没有.aspx扩展的情况下访问.aspx页面。它有效地将.aspx添加到页面。这是web.config文件中的重写规则
<rewrite>
<rules>
<rule name="san aspx">
<!--Removes the .aspx extension for all pages.-->
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="/*.png" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="/*.php" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="/wordpress/*.php" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="/webservice/*.asmx" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
</rules>
</rewrite>这在asp.net页面上运行良好。
然而,它也向wordpress页面添加了.aspx扩展。因此,如果我有一个页面(显示为固定链接),比如
/recurring-billing/它查找一个名为
/recurring-billing/.aspx如果我关闭了固定链接,wordpress页面会正确显示,因为asp.net重写规则
<add input="{REQUEST_FILENAME}" pattern="/*.php" negate="true" />正确识别.php页并忽略重写。
问:我在asp.net重写规则中需要什么额外的条件才不会将.aspx添加到wordpress固定链接中。
发布于 2017-04-23 19:47:11
PHP和.NET是它们的死对头。无论你想要实现什么,这都是禁忌。
发布于 2017-04-24 05:10:38
找到了解决方案。将asp.net应用程序移回子目录,并将wordpress站点移回根目录。现在两者都起作用了。
https://stackoverflow.com/questions/43568428
复制相似问题