不支持条件模式:-l将.htaccess转换为web.config



我使用import将htaccess转换为iis上的web.config,但我收到消息"不支持条件模式:-l。"其中-l是重写端%{REQUEST_FILENAME}-l在htaccess,

htaccess

Options -MultiViews
RewriteEngine On
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

输出

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^(.+)$" ignoreCase="false" />
      <conditions>
        <!--# Necessary to prevent problems when using a controller named "index" and having a root index.php-->
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <!--The condition pattern is not supported: -l.-->
      </conditions>
      <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>

web.config中支持如何使-l,因为如果不使用-l,我可以打开我的网站并得到错误"404-找不到文件或目录。"

感谢

RewriteCond指令的文档中提取:

-l

是符号链接。

将TestString视为路径名,并测试它是否存在,是一种象征性的联系。也可以使用-L的bash约定或-h,如果存在混淆的可能性,例如在使用-lt时或CCD_ 6测试。

由于在Windows中没有符号链接的概念,因此您不需要此条件。它已经被您指定的另外两个条件所涵盖:

<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />

最新更新