Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将.htaccess文件中的条件转换为web.config_Php_.htaccess_Iis_Web Config - Fatal编程技术网

Php 如何将.htaccess文件中的条件转换为web.config

Php 如何将.htaccess文件中的条件转换为web.config,php,.htaccess,iis,web-config,Php,.htaccess,Iis,Web Config,我有一个.htaccess文件: RewriteCond %{REQUEST_URI} !/admin/ RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^(.*)$ rewrite.php 如何在web.config文件中重写此文件?试试这个 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system

我有一个.htaccess文件:

RewriteCond %{REQUEST_URI} !/admin/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^(.*)$ rewrite.php
如何在web.config文件中重写此文件?

试试这个

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="/admin/" ignoreCase="false" negate="true" />
                        <add input="{THE_REQUEST}" pattern="^[A-Z]{3,}\s([^.]+)\.php" />
                    </conditions>
                    <action type="Rewrite" url="rewrite.php" />
                </rule>
            </rules>
        </rewrite>

    </system.webServer>
</configuration>