2012-11-07 69 views
1

我已經遍及這個網站和網絡搜索,但我仍然無法得到這個權利。我有很多這樣的網址:http://archives.cancunandrivieramaya.com/archives/cancun.cgi/md/read/id/XXXX,我想重定向到主頁http://www.cancunandrivieramaya.com/。子域不再存在。如何編寫mod-rewrite以將通配符的子域重定向到主頁?這是100的那些不工作:(使用mod_rewrite將不存在的子域重定向到主頁

RewriteCond %{HTTP_HOST} !^www\.cancunandrivieramaya\.com [NC] 
RewriteCond %{HTTP_HOST} ^archives\.cancunandrivieramaya\.com([a-z0-9]+)\ 
RewriteRule (.*) http://www.cancunandrivieramaya.com/[L,QSA] 

任何幫助將非常感激之一。

回答

0

我知道了!多虧了這篇文章阿爾塔夫卡特里http://www.altafkhatri.com/Technical/Configure/How-to-publish-or-host-subdomain-on-winhostcom/Solution-resolution我能追隨他的腳步設立在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> 

完美的作品

相關問題