0
votes

I am moving a PHP application from Apache to IIS server. I am trying to translate the following .htaccess rule:

RewriteEngine On
RewriteRule ^(.*)$ public/$1?%{QUERY_STRING} [QSA,L]

It simply redirects all requests (as well as query string) to public subdirectory.

I have tried something like the following in web.config file-

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <rewrite>
        <rules>
            <rule name="Root Hit Redirect" stopProcessing="true">
                <match url="^$" />
                <action type="Redirect" url="/public/index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

But it keeps falling into redirect loop. What should be correct web.config rule in this case?

1

1 Answers