Vinyl Warmth Vinyl Warmth - 3 months ago 62
ASP.NET (C#) Question

Too many redirects error after defining a redirect in Web.config

I have an ASP.NET MVC (5) application and need to redirect urls such as


I've defined a redirect in Web.config in

<rule name="london">
<match url="london" />
<action type="Redirect" url="locations/london" />

When I run the site locally and browse to
I get the following error

localhost redirected you too many times. ERR_TOO_MANY_REDIRECTS

What am I doing wrong?

I've spent some time looking online but can't find the answer...

Answer Source

your rule is basically saying if the URL contains London then redirect to locations/London. But locations/London contains the word London too so it will redirect again.

Try setting the rule to be


(start with london)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download