将htaccess文件转换为web.config文件的错误

时间:2017-11-24 16:07:24

标签: php apache .htaccess mod-rewrite web.config-transform

我将htaccess文件转换为web.config文件时出现问题, 我正在使用一个MVC PHP项目,并且每件事都很棒,直到托管我的应用程序,托管人告诉我,我必须使用web.config文件,我创建了一个,但它没有工作,

这是我的htaccess文件:

Options -MultiViews RewriteEngine On RewriteBase /myProject/public RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.+)$ index.php?url=$1 [QSA,L]

我尝试将其作为web.config:

<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Imported Rule 1" stopProcessing="true">
                <match url="^(.*)/$" ignoreCase="false" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Redirect" redirectType="Permanent" url="/myProject/public/{R:1}" />
            </rule>
            <rule name="Imported Rule 2" stopProcessing="true">
                <match url="^" ignoreCase="false" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="myProject/public/index.php?url={R:1}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

并且我也尝试更改参数&#34; myProject / public&#34;在网址....并且它不起作用,

感谢名单

0 个答案:

没有答案