我正在尝试将.htaccess
文件导入 IIS 7 中的 URL 重写规则。
Symfony 2 中的当前文件无法将其导入 IIS。我需要知道将文件转换为 IIS 可用的文件的语法的人的帮助,呼吁这项工作将帮助任何未来在 IIS 中使用 Symfony 2 的用户。
我很抱歉不知道 IIS 中的语法。我附加了原始文件/web/.htaccess
,为方便起见排除了所有评论。
提前致谢
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>
当前的错误输出是这样的:
<rewrite>
<rules>
<!--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'-->
<rule name="Imported Rule 3" stopProcessing="true">
<match url=".?" ignoreCase="false" />
<conditions>
<!--# If the requested filename exists, simply serve it.-->
<!--# We only want to let Apache serve files and not directories.-->
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<!--This rule was not converted because it contains references that are not supported: 'ENV::BASE'-->
</rules>
</rewrite>
提前致谢