简体   繁体   中英

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

I use import for convert htaccess to web.config on iis but i get message 'The condition pattern is not supported: -l.' where -l is RewriteCond %{REQUEST_FILENAME} !-l in 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]

Output

<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>

how to make the -l is supported in web.config, because if not use the -li can open my website and get error "404 - File or directory not found."

thankyou

Picking up from the RewriteCond directive's documentation:

-l

Is symbolic link.

Treats the TestString as a pathname and tests whether or not it exists, and is a symbolic link. May also use the bash convention of -L or -h if there's a possibility of confusion such as when using the -lt or -le tests.

Since, in Windows, there is no concept of a symbolic link, you would not need this condition. It is already being covered by the other two conditions you have specified:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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