如何将web.config文件转换为.htaccess

时间:2017-06-28 05:10:06

标签: php .htaccess url-rewriting web-config

有人可以帮助我将此web.config文件转换为.htaccess

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

1 个答案:

答案 0 :(得分:0)

这看起来像一个标准的前控制器模式。即。内部重写所有未映射到现有文件或目录的index.php?permalink=<URL>请求。

所以,在.htaccess中这样的事情:

RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?permalink=$1 [L]