【发布时间】:2013-07-09 01:15:21
【问题描述】:
我正在尝试将.htaccess 文件导入到 IIS 7 中的 URL 重写规则中。
Symfony 2 中的当前文件无法将其导入 IIS。我需要知道语法的人的帮助,将文件翻译成 IIS 可用的东西,呼吁这项工作将帮助任何未来在 IIS 中使用 Symfony 2 的用户。
对于不了解 IIS 中的语法,我深表歉意。我附加了原始文件/web/.htaccess,为方便起见,不包括所有的cmets。
提前致谢
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>
提前致谢
【问题讨论】:
标签: apache iis mod-rewrite symfony url-rewrite-module