2013-04-23 83 views
1

任何人都可以告訴我下面的重寫轉換將如何爲web.config文件?重寫規則轉換爲web.config

RewriteEngine On 
RewriteRule ^/(credits|content)/?$ switch.php?view=$1 

或者,如果有任何在線轉換工具,將是偉大的。

感謝

編輯

例如:

RewriteCond %{HTTP_HOST} ^example\.com$ [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 

是:

<rewrite> 
    <rules> 
    <rule name="Imported Rule 1" stopProcessing="true"> 
     <match url="^(.*)$" ignoreCase="false" /> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="^example\.com$" /> 
     </conditions> 
     <action type="Redirect" redirectType="Permanent" url="http://www.example.com/{R:1}" /> 
    </rule> 
    </rules> 
</rewrite> 

回答

0

這將轉換2種輸入的網址是這樣的:

http[s]://yoursite.com/credits => switch.php.view=credits 
http[s]://yoursite.com/credits/ => switch.php.view=credits 
http[s]://yoursite.com/content => switch.php.view=content 
http[s]://yoursite.com/content/ => switch.php.view=content 

注:此規則不守在網址如參數:

http[s]://yoursite.com/credits?param1=aa&param2=bb => switch.php.view=credits 
http[s]://yoursite.com/credits/?param1=aa&param2=bb => switch.php.view=credits 
http[s]://yoursite.com/content?param1=aa&param2=bb => switch.php.view=content 
http[s]://yoursite.com/content/?param1=aa&param2=bb => switch.php.view=content 
+0

感謝您的回答,但即時通訊還是有點困惑,那裏正是我會把這些我看到的樣子我已經在提供的編輯的例子我題。 – 2013-04-25 16:12:02