Copied to clipboard

Flag this post as spam?

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


  • Anders Brohus 193 posts 474 karma points
    May 10, 2019 @ 06:47
    Anders Brohus
    0

    Umbraco Cloud - Redirect

    Hi Our! :)

    Hope you guys can help me with some redirects which i'm not the best at.. :)

    I have an Cloud project with two envirements, live and dev :)

    https://anders-s-sensitive-beaver.s1.umbraco.io/

    https://dev-anders-s-sensitive-beaver.s1.umbraco.io/

    I want to redirect the live envirement to my actual domain, but keeping the dev envirement.

    <rule name="Redirects umbraco.io to actual domain" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^(.*)?.s1.umbraco.io$" />
        <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://<your actual domain here>.com/{R:0}" 
              appendQueryString="true" redirectType="Permanent" />
    </rule>
    

    This one redirects everything.. So i tried reconfigure it to this,

    <rule name="Redirects umbraco.io to actual domain" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="anders-s-sensitive-beaver.s1.umbraco.io" />
        <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://<your actual domain here>.com/{R:0}" 
              appendQueryString="true" redirectType="Permanent" />
    </rule>
    

    But it still wont work like i want to, how is i supposed to do?

  • Søren Kottal 530 posts 3521 karma points MVP 2x c-trib
    May 10, 2019 @ 07:19
    Søren Kottal
    100

    Hi Anders

    The pattern is a regex, so you need to make it not match your dev-environment.

    You could add your first one, to a config transform for your live environment. That is what I usually do, because then I can have the rule on my baseline project, and only need to change the redirect url.

    You could also add a ^ to your HTTP_HOST pattern. This means, that the host must start with the pattern..

    <rule name="Redirects umbraco.io to actual domain" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^anders-s-sensitive-beaver.s1.umbraco.io$" />
        <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://<your actual domain here>.com/{R:0}" 
              appendQueryString="true" redirectType="Permanent" />
    </rule>
    
  • Anders Brohus 193 posts 474 karma points
    May 10, 2019 @ 07:28
    Anders Brohus
    0

    Thanks alot Søren :)

  • 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