2013-07-22 74 views
0

我正在使用apache mod重寫,並且我有一個.htaccess重寫語句。我想轉換使用IIS服務器,並想知道是否有人可以給我如何將現有的.htaccess語句轉換爲iis web.config的建議。如何將此Apache模塊重寫轉換爲iis web.config

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 
</IfModule> 

專家建議表示讚賞。

回答

0

已解決。從Microsoft Web平臺安裝程序下載URL重寫。當你通過ui指定規則時,Url重寫模塊可以自動創建web.config。

1

對於IIS 7,您可以使用<system.webServer><rewrite>部分。有一篇關於翻譯.htaccess到web.config的優秀文章here

<rewrite> 
    <rules> 
    <rule name="Your Rule" stopProcessing="true">  
     <match url="^(.*)$" ignoreCase="false" />  
     <conditions>   
      <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />   
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />   
     </conditions>  
     <action type="Rewrite" url="index.php?url={R:1}" />  
    </rule> 
    </rules> 
</rewrite> 
+0

嗨,它不工作 – Slay

+1

哪個版本的IIS? – kheld

+0

嗨!我解決了它!你可以下載url_rewrite,它會使用一個簡單的UI規則自動創建web.config文件 – Slay