Copied to clipboard

Flag this post as spam?

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


  • Tom Bruce 121 posts 505 karma points
    Nov 16, 2017 @ 22:46
    Tom Bruce
    0

    URL Rewrite

    Hi everyone, trying to write a simple url redirect, but failing. What is wrong with this code,

      <rule name="admin" stopProcessing="true">
                    <match url="http://localhost/mysite/umbraco" />
                    <action type="Redirect" url="www.google.com" />
                </rule>
            </rules>
    
  • Dan Diplo 1505 posts 5911 karma points MVP 4x c-trib
    Nov 17, 2017 @ 09:23
    Dan Diplo
    0

    Try this:

    <rule name="admin" stopProcessing="true">
      <match url="^umbraco" />
      <action type="Redirect" url="https://www.google.com" />
    </rule>
    

    You don't really need the http://localhost/ part unless you only want to match on localhost. Using ^ matches the start of the path.

    Add the http(s) protocol to your redirect if it's an external URL.

  • Tom Bruce 121 posts 505 karma points
    Nov 17, 2017 @ 10:34
    Tom Bruce
    0

    Thanks Dan, how can I redirect to the umbraco admin page. both rules redirect to the home page lol. thanks for your help.

    <rewrite
      <rules>
        <rule name="Admin Redirect" stopProcessing="true">
          <match url="^umbraco" />
          <action type="Redirect" url="http://localhost/mysite/" />
        </rule>
        <rule name="NewAdmin" stopProcessing="true">
          <match url="^admin" />
          <action type="Redirect" url="http://localhost/mysite/umbraco" />
        </rule>
      </rules>
    </rewrite
    
  • Angelo Ryndon 6 posts 115 karma points
    Feb 25, 2018 @ 02:27
    Angelo Ryndon
    0

    I have this problem as well. Trying to restrict access to the backoffice using the default

    http://your-host/umbraco/

    I tried the redirect trick like this but it will loop back to the home page or whatever page you redirected the match url=^umbraco.

    Rewriting also does not work mainly because I don't know the actual file that the server should serve

    <rewrite
      <rules>
        <rule name="Redirect" stopProcessing="true">
          <match url="^umbraco" />
          <action type="Redirect" url="http://localhost/" />
        </rule>
        <rule name="Rewrite" stopProcessing="true">
          <match url="^admin" />
          <action type="Rewrite" url="http://localhost/umbraco" appendQueryString="false" />
        </rule>
      </rules>
    
    </rewrite>
    

    The rewrite would fail with a 404 not found error As stated earlier, two redirect rules will cause a loop. I've been at this the whole day now. Any help is appreciated.

    Thanks!

  • Angelo Ryndon 6 posts 115 karma points
    Mar 22, 2018 @ 01:04
    Angelo Ryndon
    0

    I believe creating a subdomain specifically for logging in to the backoffice is our only practical solution for now. Changing paths and some other voodoo is a no-go for me because I want site upgrades to be easy. I posted the subdomain solution I did on another thread

    Just in case anyone stumbles into this :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies