IIS7 url rewriting results in 500 internal server error

102 views Asked by At

I run my website on IIS7 and have the following rewrite rule for my website:

 <rule name="five21 https redirect" stopProcessing="true">
              <match url="(.*)"/>
              <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                  <add input="{HTTPS}" pattern="^ON$"/>
                  <add input="{HTTP_HOST}" pattern="^five21.nl"/>
              </conditions>
              <action type="Redirect" url="https://www.five21.nl/{R:1}" redirectType="Permanent"/>
          </rule>
          
          <rule name="five21.nl Redirect" stopProcessing="true">
              <match url="(.*)"/>
              <conditions logicalGrouping="MatchAll">
                  <add input="{HTTPS}" pattern="^OFF$"/>
                  <add input="{HTTP_HOST}" pattern="^five21.nl"/>
              </conditions>
              <action type="Redirect" url="https://www.five21.nl/{R:1}" redirectType="Permanent"/>
          </rule>

Basically, I am trying to redirect urls such as https://five21.nl to https://www.five21.nl and http://www.five21.nl -> https://www.five21.nl. However, each time I get a 500 internal server error, I included in the bindings that if websites such as http://five21.nl, http://www.five21.nl or https://five21.nl are called it would go via the rewrite and all be redirected to https://www.five21.nl but with no result. Am I missing something here? edit: added screenshot of given error: enter image description here

1

There are 1 answers

0
Hedayat On

I found out that the web.config file had reached its limit hence any new rules were simply skipped. I simply deleted some old rules that weren't being used anymore and the rules above are working perfectly fine now