htaccess for web.config

5

I moved my site to the Windows Azure platform and their server is IIS and my old one was apache so the routes configured in htaccess are not working, I need to know how to convert this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

php_value short_open_tag off

RewriteCond %{HTTP_HOST} ^meusite\.com\.br$ [OR]
RewriteCond %{HTTP_HOST} ^www\.meusite\.com\.br$

In web.config (similar to xml) to work in IIS     

asked by anonymous 27.06.2014 / 15:34

1 answer

6

Conversion by URL Rewrite (you can install on your IIS local and manages the output by the .htaccess file) is in a file web.config in this way, based on your .htaccess of the question:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

In link also has several file styles ( .htaccess ), which you can rely on for your system to work on your IIS of Windows Azure and in this link another practical example of the subject.

References:

27.06.2014 / 17:33