【发布时间】:2017-08-05 10:04:26
【问题描述】:
我有一个网络服务器,我有两个名为 http://example.mx 和 http://example.com.mx 的域都指向同一个网络服务器和根文件夹,我可以将我的网站与两个域一起使用,目前我可以使用 www.也是,但这是我要删除的,我做到了,我得到了这个 web.config 文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="CGI-exe" />
<add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Script" allowPathInfo="true" />
</handlers>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule2" enabled="false">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example\.com\.mx$" negate="true" />
</conditions>
<action type="Redirect" url="http://example.com.mx/{R:1}" />
</rule>
<rule name="CanonicalHostNameRule1" enabled="false">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example\.mx$" negate="true" />
</conditions>
<action type="Redirect" url="http://example.mx/{R:1}" />
</rule>
<rule name="http a https" enabled="false" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
但问题是我去http://example.mx 它把我送到http://example.com.mx 并且它应该是这样工作的:
如果我去http://www.example.mx 重定向到http://example.mx
如果我去http://www.example.com.mx 重定向到http://example.com.mx
但是现在如果我转到 http://www.example.mx 它会重定向到 http://example.com.mx 而我不想要这个,我需要在模式中更改什么?
【问题讨论】:
标签: url redirect iis url-rewriting windows-server-2012