簡體   English   中英

將 Apache .htaccess 規則轉換為 IIS web.config 為 append.php 文件擴展名

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

我正在使用以下.htaccess代碼。 但是我需要將我的.htaccess文件內容轉換為web.config文件。 我不知道該怎么做。 請檢查下面我的.htaccess代碼:

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

如何將其轉換為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 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