4
我正在部署使用APIGILITY
开发到IIS的API。由于IIS不支持.htaccess我试图从.htaccess文件的内容中创建web.config文件。我使用IISv7.5并试图安装URL重写器来转换规则。但是我在转换时遇到错误。请在.htaccess文件下面找到我从urlRewriter获得的相应转换。htaccess规则(mod_rewrite)转换为web.config规则
.htaccess文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
转换的规则和错误,我得到的。
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^.*$" />
<conditions logicalGrouping="MatchAny">
<!--The condition pattern is not supported: -s.-->
<!--The condition pattern is not supported: -l.-->
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<!--The rule cannot be converted into an equivalent IIS format because of unsupported flags: E-->
<!--This rule was not converted because it contains references that are not supported: 'ENV::BASE'-->
</rules>
</rewrite>
我可以得到一些帮助吗?
我不认为你仍然需要一个基地排序的发现者在你的规则。实际上,如果你有一个规则来内部重写每个文件/文件夹(除了现有的文件)到根目录'index.php',那么它是否正确? –
index.php是否使用这个环境变量?或者这只是一个非常复杂的方式来重写每个请求到这个目录中的index.php文件? – Sumurai8
你有解决这个问题吗?我有同样的问题。 –