Copied to clipboard

Flag this post as spam?

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


  • Angelo Corleone 6 posts 115 karma points
    Feb 25, 2018 @ 02:34
    Angelo Corleone
    0

    How to prevent access to default backoffice URL

    Hello Everyone

    Using v7.8 I don't know how to prevent access to the default backoffice url using only IIS rewrite module.

    two redirects like below will create a loop and fails:

    <rewrite>
          <rules>
            <rule name="Redirect to admin" enabled="true" stopProcessing="true">
              <match url="^admin\/?.*" />
              <action type="Redirect" url="http://your-local-host/umbraco/" appendQueryString="false" redirectType="Permanent"/>
            </rule>
            <rule name="Redirect request from default url" enabled="true" stopProcessing="true">
              <match url="^umbraco\/?.*" />   
              <action type="Redirect" url="http://your-local-host/" appendQueryString="false" redirectType="Permanent" />
            </rule>
          </rules>
        </rewrite>
    

    A rewrite fails with a 404.4 not found

     <rewrite>
                  <rules>
                    <rule name="Rewrite Url to admin" enabled="true" stopProcessing="true">
                      <match url="^admin\/?.*" />
                      <action type="Rewrite" url="http://your-local-host/umbraco/" appendQueryString="false"/>
                    </rule>
                    <rule name="Redirect request from default url" enabled="true" stopProcessing="true">
                      <match url="^umbraco\/?.*" />   
                      <action type="Redirect" url="http://your-local-host/" appendQueryString="false" redirectType="Permanent" />
                    </rule>
                  </rules>
        </rewrite>
    

    I think the rewrite fails because I think I should be pointing the rewrite url to an actual file the server can spit out.

    Any help is much appreciated :) I've been stuck on this for the whole day now. I don't want to change paths and reserved paths for umbraco in the web.config or change Umbraco's default folder names.

    However, I haven't tried using a subdomain for the backoffice. Is that the only way to do this? I hope there is something I just missed on 7.8 that will allow you to change the default backoffice URL without using a subdomain.

    Thanks!

  • Angelo Corleone 6 posts 115 karma points
    Mar 22, 2018 @ 00:58
    Angelo Corleone
    100

    Since this thread was not answered, I will just put the workaround I did for this issue. I set up a sub-domain that points to the same website and added a URL rewrite rule so anyone who comes to the subdomain will still be redirected to the main domain, unless they want to login to the backoffice.

    Pretty much like the rewrite rule used for umbraco cloud url pointing to your main domain.

            <rule name="Redirect backoffice subdomain to WWW domain" patternSyntax="ECMAScript" stopProcessing="true">
          <match url=".*" ignoreCase="true" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^(www\.)?your-subdomain\.your-main-domain\.co\.nz$" />
            <add input="{REQUEST_URI}" negate="true" pattern="^/umbraco" />
            <add input="{REQUEST_URI}" negate="true" pattern="^/DependencyHandler.axd" />
            <add input="{REQUEST_URI}" negate="true" pattern="^/App_Plugins" />
            <add input="{REQUEST_URI}" negate="true" pattern="localhost" />
          </conditions>
          <action type="Redirect" url="http://www.your-main-domain/{R:0}"
          appendQueryString="true" redirectType="Permanent" />
        </rule>
    
Please Sign in or register to post replies

Write your reply to:

Draft