htaccess for web.config

Asked

Viewed 1,434 times

5

I switched my website to the platform Windows Azure and their server is IIS and my old one was Apache so the routes configured in htaccess are not working, 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 on IIS

  • You can use a covnersor online to test: Link

  • Cool, but it just converts the RewriteRule

1 answer

6


Conversion by URL Rewrite (you can install in your IIS local and manage output by archive .htaccess) stays in a file web config. thus, based on its .htaccess of the issue:

<?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 that link also features various file styles (.htaccess), that you can rely on for your system to work on your IIS of Windows Azure and in that link another practical example of the subject.

References:

  • 1

    Wow, that worked, thanks! I had even managed in a similar way but was giving error in finding the css files and images, but its way worked!

  • @Silvioandorinha legal ... !!! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.