我们目前在子域http:// blog.domain.com下运行wordpress博客。该网站目前也通过反向代理运行,http:// www.domain.com/blog指向原始子域网站。
目前这两个网站都运行正常但我们遇到的问题是我们希望子域网站重定向到反向代理网站而不进行渲染。我们只希望网站呈现为http:// www.domain.com/blog。我一直在尝试在服务器2008计算机上使用IIS 7中的URL Rewrite。
我认为我遇到的问题是正则表达式。我尝试使用 - ^(博客。)* - 当我在IIS中测试它时,它返回它匹配(blog.domainname.com),但是当我在浏览器中打开它时,站点本身不会重定向。我不确定我错过了什么。在此先感谢您的帮助。
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" /></rule>
<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>
<rule name="redirect to /blog" enabled="false" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^(blog.)*" />
<action type="Redirect" url="http:// www.domainname.com/blog" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="(.*)" />
</conditions>
</rule>
</rules>
</rewrite>
答案 0 :(得分:0)
问题可能是当你点击该URL时你的重写规则没有运行。
确保它实际映射到该站点。
抱歉,我刚注意到您的规则未启用:
<rule name="redirect to /blog" enabled="false" patternSyntax="ECMAScript" stopProcessing="true">
您必须将enabled属性修改为True。