编程语言
首页 > 编程语言> > php-htaccess在iis上不起作用

php-htaccess在iis上不起作用

作者:互联网

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

我只是知道我需要使用web.config而不是htaccess.请在下面找到我的htaccess

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

我如何将其转换为web.config?

解决方法:

将以下代码复制粘贴到您的web.config中

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" 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/{R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

标签:iis,web-config,rewrite,php,htaccess
来源: https://codeday.me/bug/20191102/1989093.html