Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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
.htaccess 如何将此htaccess转换为iis web.config?_.htaccess_Iis - Fatal编程技术网

.htaccess 如何将此htaccess转换为iis web.config?

.htaccess 如何将此htaccess转换为iis web.config?,.htaccess,iis,.htaccess,Iis,为什么当我通过IIS管理器>重写URL使用IIS web.config自动转换.htaccess时会显示404错误 如何手动将其转换为web.config <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(install)($|/) - [L] RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </I

为什么当我通过IIS管理器>重写URL使用IIS web.config自动转换.htaccess时会显示404错误

如何手动将其转换为web.config

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^(install)($|/) - [L]
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

重新启动发动机
重写规则^(安装)(美元/)-[L]
重写规则^$app/webroot/[L]
重写规则(*)app/webroot/$1[L]
这是使用IIS管理器(web.config)的结果


404错误的子状态代码是什么?因为404.0和404.19是不同的错误。您可以在C:\inetpub\logs\LogFiles中找到它

看起来规则已正确转换

规则1将扫描传入的URLdomain.com/install/domain.com/install,并防止重写这些URL

规则2将domain.com重写为domain.com/app/webroot/

例如,规则3将重写任何传入规则domain.com/a.aspxdomain.com/app/webroot/a.aspx

那么,这些规则是否符合您的要求

承诺重写可以在没有保证的情况下进行

1.请确保已将请求传递到IIS服务器。有时网络问题会将请求路由到另一台服务器并返回404错误

2.请确保可以访问目标URL,如domain.com/app/webroot/或domain.com/app/webroot/(*),而不会出现任何问题

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(install)($|/)" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="/app/webroot/" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="/app/webroot/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>