I am using URL Rewrite to force a http to https redirect. It is working, except it is adding a second trailing slash to the URL. So for example, if I go to http://example.com, the rewritten URL ends up being https://example.com//. I don't want even 1 trailing slash, let alone 2 and I cannot get rid of it. I tried this solution but it didn't work. Might be because the person wanted to get rid of the trailing slash, and I have 2 of them so it isn't matching?
I have the below rules in my web.config file. I am running Windows Server 2019 with IIS 10 and the URL Rewrite Module. If someone can show me where I am going wrong, I'd appreciate it!
<rule name="HTTPS Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{REQUEST_URI}" appendQueryString="false" />
</rule>
<rule name="SEO - Remove trailing slash" stopProcessing="false">
<match url="(.+)/$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_METHOD}" pattern="GET" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="_{R:1}" />
</rule>