2012-07-25 85 views
-1

我想將.htaccess文件轉換爲web.config我想將.htaccess文件轉換爲web.config

下面是代碼

AddType application/x-httpd-php .html 
RewriteEngine on 

RewriteBase/

RewriteCond %{Request_Filename} !-d 
RewriteCond %{Request_Filenam}e !-f 

RewriteRule ^pages/([0-9A-Za-z_\-~',]+) page_details.html?category_page_title=$1 [NC] 

任何人可以幫助我這個.htaccess文件轉換爲web.config文件。

在此先感謝。

+0

,如果你已經在這個哪怕只是一丁點做出了嘗試這將是很好。我們在這裏非常重視努力,即使它是錯誤的或錯誤的。即使對[IIS UrlRewrite](http://learn.iis.net/page.aspx/734/url-rewrite-module/)文檔進行了最簡潔的掃描,您也可以看到以下鏈接:http://learn.iis。 net/page.aspx/470/imported-apache-modrewrite-rules /,或者單擊IIS UrlRewrite功能RHS操作面板中的幫助按鈕。即使進口無法正常工作,我們也非常歡迎幫助解決問題,因爲現在我們有一些工作要做。謝謝。 – Kev 2012-07-25 12:18:30

回答

3

對於整個.htaccess文件的轉換,請參閱本手冊:http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/

這是很全面的,並解釋如何將規則轉換。


如果你只想重寫轉換規則,請閱讀這篇文章: http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/

這是一個比較一步一步的GUI好心的嚮導,但在你的情況下,它也許應該是足夠的。


在任何情況下,你列出的規則最終可能會與此(的部分)web.config

<rewrite> 
     <rules> 
      <rule name="page details" stopProcessing="true"> 
       <match url="^/pages/([0-9A-Za-z_\-~',]+)" ignoreCase="true" /> 
       <conditions> 
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
       </conditions> 

       <action type="Redirect" redirectType="Permanent" url="/page_details.html?category_page_title={R:1}" /> 
      </rule> 
     </rules> 
    </rewrite> 
相關問題