Skip to main content

Resolving Redirect Rule Issues in Umbraco Cloud

Redirect rule issues can cause deployment to failure. How to avoid and solve that.

Joana Knobbe avatar
Written by Joana Knobbe
Updated over 2 weeks ago

Redirect rule misconfigurations in Umbraco Cloud environments can lead to issues with both deployment processes and URL redirection functionality. This article outlines common problems and provides practical solutions to help you debug and correctly configure your redirect rules.

In particular, managing 301 redirects effectively is crucial not only for troubleshooting but also for optimizing traffic flow and maintaining a seamless user experience. This article will also discuss broader tools and methods for redirect management in Umbraco Cloud.

Common Redirect Rule Issues in Umbraco Cloud

Redirect Rule Blocking Umbraco Deploy API

A specific redirect rule in your web.config , or a rewrite configuration can block Umbraco Deploy’s remote API, which is necessary for actions like content restoration. A typical problematic rule looks like this:

<rule name="Redirect to www" stopProcessing="true">   
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^([yourdomain.com](https://yourdomain.com)|[yourproject.uksouth01.umbraco.io](https://yourproject.uksouth01.umbraco.io))$" ignoreCase="true" />
</conditions>
<action type="Redirect" url="[redirect URL]" redirectType="Permanent" />
</rule>

If this rule does not include the following condition:

<add input="{HTTP_HOST}" negate="true" pattern="\.azurewebsites\.net$" />

Then Umbraco Deploy’s API calls from Azure might be incorrectly redirected or blocked. To fix this issue:

  1. Open your web.config file.

  2. Locate the specific redirect rule.

  3. Add the missing condition to ensure requests from .azurewebsites.net are excluded from the redirect.

This ensures that Deploy’s remote API calls function correctly, allowing content to restore without interruptions.

Subdomain to Subdomain Redirect Failures

When attempting to set up subdomain-to-subdomain redirects in an Umbraco Cloud environment, issues may arise, particularly with IIS URL Rewrite rules. To ensure your redirects work properly, follow these guidelines:

  1. Use a web.config transform: - Deploy the rules via a web.config transform that inserts your redirect configuration into the existing wwwroot web.config file on Umbraco Cloud during deployment. - Use the XML transform element: <rewrite xdt:Transform="Insert"> to ensure rules are merged correctly.

  2. Validate Match Conditions and Capture Groups: - Verify that the rules target the correct hosts. - Ensure backreferences in your action URL align with your capture group structure. For example: - If your match captures the entire URL, use {R:0}. - For matched subgroups, use {R:1}, {R:2}, etc. A mismatch here can prevent the redirect from functioning correctly.

  3. Check Other Rewrite Rules: Confirm that other rules in the same IIS URL Rewrite file are working to rule out broader configuration or deployment issues.

  4. Test Your Configuration: - Validate regex patterns and backreferences for the specific subdomain environments you are redirecting. - Use testing tools or a deployment sandbox to identify issues before pushing changes to production.

Following these steps ensures that your redirects work seamlessly after deployment.


Best Practices for Redirect Configurations in Umbraco Cloud

  1. Test redirect rules in a staging environment before deployment.

  2. Include conditions to handle exceptions, such as .azurewebsites.net domains, to avoid blocking critical API requests.

  3. Always document your redirect rules and specify their intended purposes for easier debugging in the future.

  4. Use tools like IIS Rewrite Testing or browser developer tools to quickly identify redirect chain issues.

Additionally, consider leveraging built-in tools like the Umbraco URL Redirect Manager for user-friendly redirect setup or third-party packages such as Skybrud Redirects to handle more intricate scenarios efficiently.


By applying these diagnostics and configuration techniques, you can resolve common redirect issues and maintain smooth deployments on Umbraco Cloud.

Restarting your cloud environment through the Umbraco Cloud portal can often resolve temporary redirect issues. This step ensures the environment is refreshed, clearing potential misconfigurations.

Did this answer your question?