我开始(通过Web Installer Platform(在我的Windows(2012(服务器上安装WordPress博客。
在这台服务器上,我已经托管了一个 ASP.NET MVC 4.5 站点。
现在,在我继续配置WordPress网站之前(通过打开www.***.com/wp-config.php(,
我似乎在IIS/web.config中创建了一个新的重定向规则。
否则,它将与现有的 ASP.NET 站点发生冲突。
我尝试过这个重定向规则:
<rule name="wordpress blog" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<add input="{REQUEST_URI}" pattern="^/(blog)" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule>
使用此规则,当打开 https://www.****.com/blog/wp-config 时.php我最终会在 https://www.****.com/blog/error?aspxerrorpath=/blog/wp-config.php 上出现运行时错误
当添加www.***.com/wp-config.php(所以在根文件夹中(
<rule name="block" stopProcessing="true">
<match url="^blog$" />
<action type="none" />
</rule>
并转到 https://www.***.com/blog/wp-config.php,我收到与上面相同的错误页面。
我似乎无法弄清楚这个规则应该是什么样子。有没有人可以帮助我?
根据您的描述,我建议您尝试在 asp.net 应用程序中使用 belwo url 重写规则。
此规则会将包含 blob 的所有请求重定向到索引.php。
<rule name="wordpress blog" >
<match url="blog/(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="http://{yourdomian}/blog/index.php"/>
</rule>
通过在 global.asax.cs 中的 ExclusionFilter 中添加"blog"来解决,如下所示:
i18n.UrlLocalizer.QuickUrlExclusionFilter = new System.Text.RegularExpressions.Regex(@"(?:sitemap.xml|.css|.JPG|.巴布亚新几内亚|.svg|.哇哇|。woff2|.EOT|.js|.html|.JSON($|(?:博客("(;