2014-02-10 2 views
0

Для перезаписи URL-адреса мне нужна поддержка.mydomain.com, чтобы указать на mydomain.com/support. У меня есть переписывание в support.mydomain.com/support.URL-адрес переопределить в поддомен

Я пробовал 2 разных варианта, но не повезло. Любая помощь приветствуется.

Version 1

<rewrite> 
    <rules> 
     <rule name="rewrite support" enabled="true"> 
      <match url="(.*)" /> 
      <conditions logicalGrouping="MatchAny"> 
     <add input="{HTTP_HOST}" pattern="^support.mydomain.com$" /> 
     </conditions> 
     <action type="Rewrite" url="\support\{R:0}" /> 
     </rule> 
    </rules> 
</rewrite> 

Version 2

<rule name="Support Rule" stopProcessing="false"> 
    <match url="(.*)" /> 
    <conditions> 
     <add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.mydomain\.com$" /> 
    </conditions> 
    <action type="Rewrite" url="{C:1}/{R:1}" /> 
</rule> 

ответ

0

я смог найти this post Скотт Форсайт, который получил это работает для меня.

Как говорится в статье «Это перенаправит ссылку http://anything_except_www.domain.com на http://domain.com/anything_except_www.».

<rewrite> 
    <rules> 
     <rule name="CName to URL" stopProcessing="true"> 
      <match url=".*" /> 
      <conditions> 
       <add input="{HTTP_HOST}" pattern="^(?!www)(.*)\.domain\.com$" /> 
      </conditions> 
      <action type="Redirect" url="http://domain.com/{C:1}/" /> 
     </rule> 
    </rules> 
</rewrite> 

Надеюсь, это поможет кому-то!

Смежные вопросы