M
M
MasterCopipaster2021-04-03 13:13:45
IIS
MasterCopipaster, 2021-04-03 13:13:45

How to combine two redirect rules?

Good day, I set up redirect rules on IIS from http to https I
use this instruction I also have a rule ala "mod_rewrite" that redirects all requests to php to index.php The

trouble is that only 1 rule works if I enable redirect from http to https it works but "mod_rewrite" does not work and vice versa... lived all his life with the Apache, and I ask you to tell me how to combine these two rules?
web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="Silex Front Controller" enabled="true" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
                <rule name="http-to-https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question