apache - Problems importing .htaccess into IIS URL Rewrite Web.Config -
i'm trying import .htaccess
file url rewrite rule in iis 7.
the current file in symfony 2 fails importing iis. need of knows syntax translate file usable iis, appealing fact work future user of symfony 2 in iis.
i apologize not know syntax in iis. , append original file /web/.htaccess
, excluding comments convenience.
thanks in advance
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>
the current error output this:
<rewrite> <rules> <!--the rule cannot converted equivalent iis format because of unsupported flags: e--> <!--this rule not converted because contains references not supported: 'env::base'--> <rule name="imported rule 3" stopprocessing="true"> <match url=".?" ignorecase="false" /> <conditions> <!--# if requested filename exists, serve it.--> <!--# want let apache serve files , not directories.--> <add input="{request_filename}" matchtype="isfile" ignorecase="false" /> </conditions> <action type="none" /> </rule> <!--this rule not converted because contains references not supported: 'env::base'--> </rules> </rewrite>
thanks in advance
if run app.php root of domain (http://domain.tld/app.php) can remove env:base variables. result in following xml import in iis:
<rewrite> <rules> <rule name="imported rule 1" stopprocessing="true"> <match url="^app\.php(/(.*)|$)" ignorecase="false" /> <action type="redirect" redirecttype="permanent" url="/{r:2}" /> </rule> <rule name="imported rule 2" stopprocessing="true"> <match url=".?" ignorecase="false" /> <conditions> <add input="{request_filename}" matchtype="isfile" ignorecase="false" /> </conditions> <action type="none" /> </rule> <rule name="imported rule 3" stopprocessing="true"> <match url=".?" ignorecase="false" /> <action type="rewrite" url="/app.php" /> </rule> </rules> </rewrite>
edit: subdirectory should work believe (subdir being "foo"):
<rewrite> <rules> <rule name="imported rule 1" stopprocessing="true"> <match url="^app\.php(/(.*)|$)" ignorecase="false" /> <action type="redirect" redirecttype="permanent" url="foo/{r:2}" /> </rule> <rule name="imported rule 2" stopprocessing="true"> <match url=".?" ignorecase="false" /> <conditions> <add input="{request_filename}" matchtype="isfile" ignorecase="false" /> </conditions> <action type="none" /> </rule> <rule name="imported rule 3" stopprocessing="true"> <match url=".?" ignorecase="false" /> <action type="rewrite" url="foo/app.php" /> </rule> </rules> </rewrite>
there might better way variables used iis url rewrite imports mod_rewrite. don't know syntax :)
Comments
Post a Comment