Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pedman 7 posts 87 karma points
    Feb 09, 2017 @ 08:19
    pedman
    0

    Getting redirect loop when adding a redirect in UrlRewriting.config

    Hello.

    I've added a couple of Url Redirects in my UrlRewriting.config, and they are now causing loops on my website. I'm new to umbraco, so I didn't research properly.

    So far it's only on local, but I can't seem to find a way to delete the redirect, even though it's not in the UrlRewriting.config.

    My UrlRewriting is currently empty again, and my url will look like this if I try to access my site:

    http://localhost:55151/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/

    Other subsites still working, like about page, contact etc.

    I was trying to redirect localhost:55151/ to localhost:55151/index , because localhost:55151/ was empty and didn't redirect to an index/home page.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Feb 09, 2017 @ 09:54
    Dave Woestenborghs
    0

    Hi Pedman

    May you can post the configuration ? Also I prefer to use IIS rewrites because they are faster.

    Dave

  • pedman 7 posts 87 karma points
    Feb 09, 2017 @ 10:00
    pedman
    0
    <?xml version="1.0" encoding="utf-8"?>
    <urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
      <rewrites>
        <!-- 
            URLRewriting.net is obsolete and will be removed from Umbraco in the future.
            If you want to do rewrites, make sure to use IIS URL rewrite: https://www.iis.net/downloads/microsoft/url-rewrite
            The advantage of using IIS rewrite is that it is much faster, much less CPU intensive and much less memory intensive.
        -->
      </rewrites>
    </urlrewritingnet>
    

    Not sure what config you're looking for, but this is my UrlRewriting, in which I initially added a couple of lines, but have since deleted - although that hasn't helped..

  • Stefano 61 posts 313 karma points c-trib
    Feb 09, 2017 @ 10:07
    Stefano
    0

    I thought they were the same !?

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Feb 09, 2017 @ 10:09
    Dave Woestenborghs
    1

    Did you restart your web application after making those changes ? Maybe clear your browser cache. Some browsers cache redirects.

    Dave

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Feb 09, 2017 @ 10:10
    Dave Woestenborghs
    0

    Hi Stefano,

    They are not the same. IIS redirects are managed by the server. So are done before Umbraco kicks in.

    UrlRewriting.NET is software based. So it will happen when the request hits your application.

    Also in future versions of umbraco UrlRewriting.NET will be removed.

    dave

  • Stefano 61 posts 313 karma points c-trib
    Feb 09, 2017 @ 10:13
    Stefano
    0

    Ah maybe I'm getting confused: I usually configure them on the web.config with rewriteMaps and rules both (either straight on the web.config or on a separate file):

    <rewrite>
      <rewriteMaps configSource="rewritemaps.config"/>
      <rules>
        <rule>
    

    Which I think is the same as doing it on iis.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Feb 09, 2017 @ 10:19
    Dave Woestenborghs
    1

    Hi Stefano,

    That's what i meant with IIS rewrites.

    But Umbraco also ships with a library that can do redirects and has a seperate config file in the Config folder

    Dave

  • pedman 7 posts 87 karma points
    Feb 09, 2017 @ 10:20
    pedman
    0

    Clearing cache did the trick for the loop error.

    Was sure I had already cleared it, but I guess I hadn't.

    Any suggestions as to how I should redirect localhost:55151 to /index then? Because opening it it'll just give me the error that there is no template to render at "/"

    Oh, and thank you for the help :)

  • Stefano 61 posts 313 karma points c-trib
    Feb 09, 2017 @ 10:24
    Stefano
    100

    It's always the cache!

    How about

      <rule name="Redirect / to /index" stopProcessing="true">
        <match url="^$" />
        <action type="Redirect" redirectType="Found" url="/index" />
      </rule>
    

    Didn't test it but should do it!

  • pedman 7 posts 87 karma points
    Feb 09, 2017 @ 10:39
    pedman
    0

    Thank you very much, that did it :)

  • Stefano 61 posts 313 karma points c-trib
    Feb 09, 2017 @ 10:09
    Stefano
    0

    I've had the same problem. First of all make sure that your redirects are not being cached. You can try hard refresh in Chrome, but to be 100% sure I like to use curl from git bash. Then if you could post your rewrite rules we can have a look at them.

Please Sign in or register to post replies

Write your reply to:

Draft