简体   繁体   English

将 Apache .htaccess 规则转换为 IIS web.config 为 append.php 文件扩展名

[英]Convert Apache .htaccess rules to IIS web.config to append .php file extensions

I am using below .htaccess code.我正在使用以下.htaccess代码。 But I need to convert my .htaccess file content to web.config file.但是我需要将我的.htaccess文件内容转换为web.config文件。 I have no idea how to do it.我不知道该怎么做。 please check my .htaccess code below:请检查下面我的.htaccess代码:

    RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

How can I convert this to web.config ?如何将其转换为web.config

we can put below content to the web.config file我们可以将以下内容写入 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 logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          </conditions>
          <action type="Rewrite" url="/{R:1}.php" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
  <system.web>
    <compilation tempDirectory="D:\WWW\ovintours.com\tmp" />
  </system.web>
</configuration>

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

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