0

我正在使用 apache mod rewrite 并且我有一个 .htaccess rewrite 语句。我想改用 IIS 服务器,想知道是否有人可以就如何将现有的 .htaccess 语句转换为 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>

专家建议表示赞赏。

4

2 回答 2

1

对于 IIS 7,您将使用<system.webServer><rewrite>部分。这里有一篇关于将 .htaccess 翻译成 web.config 的优秀文章

<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>
于 2013-07-24T06:19:18.110 回答
0

解决。从 Microsoft Web 平台安装程序下载 url rewrite。当您通过其 ui 指定规则时,Url 重写模块可以自动创建 web.config。

于 2013-07-25T23:18:44.383 回答