繁体   English   中英

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

[英]The condition pattern is not supported: -l convert .htaccess to web.config

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

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,因为如果不使用-li可以打开我的网站并显示错误“ 404-找不到文件或目录”。

谢谢

RewriteCond指令的文档中获取:

-l

是符号链接。

将TestString视为路径名,并测试它是否存在,并且是符号链接。 如果有混淆的可能,例如使用-lt-le测试时,也可以使用-L-h的bash约定。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM