Mod rewrite 使用mod_rewrite将不存在的子域重定向到主页

Mod rewrite 使用mod_rewrite将不存在的子域重定向到主页,mod-rewrite,subdomain,Mod Rewrite,Subdomain,我已经在这个网站和网络上搜索过了,但是我仍然不能正确地找到它。我有很多这样的URL:我想重定向到主页。子域不再存在。如何编写mod rewrite以将子域的末尾带有通配符重定向到主页?这是100种不起作用的方法之一:( 任何帮助都将不胜感激。我明白了!感谢Altaf Khatri的这篇文章,我能够按照他的逐步说明在WinHost上设置子域,然后我将此规则添加到web.config文件中: <rule name="archive redirect" enabled="true" stopPr

我已经在这个网站和网络上搜索过了,但是我仍然不能正确地找到它。我有很多这样的URL:我想重定向到主页。子域不再存在。如何编写mod rewrite以将子域的末尾带有通配符重定向到主页?这是100种不起作用的方法之一:(


任何帮助都将不胜感激。

我明白了!感谢Altaf Khatri的这篇文章,我能够按照他的逐步说明在WinHost上设置子域,然后我将此规则添加到web.config文件中:

<rule name="archive redirect" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="^www\.archives\.cancunandrivieramaya\.com$" />
          </conditions>
          <action type="Redirect" url="http://www.cancunandrivieramaya.com/" />
        </rule>

        <rule name="archives 2" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="^(www\.)?archives\.cancunandrivieramaya\.com$" />
            <add input="{PATH_INFO}" pattern="^/archives/($|/)" negate="true" />
          </conditions>
           <action type="Redirect" url="http://www.cancunandrivieramaya.com/" />
        </rule>

很好用

<rule name="archive redirect" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="^www\.archives\.cancunandrivieramaya\.com$" />
          </conditions>
          <action type="Redirect" url="http://www.cancunandrivieramaya.com/" />
        </rule>

        <rule name="archives 2" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="^(www\.)?archives\.cancunandrivieramaya\.com$" />
            <add input="{PATH_INFO}" pattern="^/archives/($|/)" negate="true" />
          </conditions>
           <action type="Redirect" url="http://www.cancunandrivieramaya.com/" />
        </rule>