diff --git a/10/umbraco-cms/reference/routing/iisrewriterules.md b/10/umbraco-cms/reference/routing/iisrewriterules.md index 3ec50ecbb7d..3a48bc72f5a 100644 --- a/10/umbraco-cms/reference/routing/iisrewriterules.md +++ b/10/umbraco-cms/reference/routing/iisrewriterules.md @@ -83,11 +83,17 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar ## Examples of rewrite rules -* A great site showing 10 very handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) +### External Resources + +If you are looking for additional inspiration or examples for creating IIS Rewrite rules, these external resources are a great starting point: + +* A great site showing 10 handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) * Another site showing some handy examples of IIS Rewrite rules: [Some useful IIS rewrite rules](https://odetocode.com/blogs/scott/archive/2014/03/27/some-useful-iis-rewrite-rules.aspx) * If you needed to a lot of static rewrites using rewrite maps: [Rule with rewrite map rule template](https://www.iis.net/learn/extensions/url-rewrite-module/rule-with-rewrite-map-rule-template) -For example, to always remove a trailing slash from the URL (make sure Umbraco doesn't add a trailing slash to all generated URLs by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md)): +### Example: Remove a Trailing Slash + +The following rule removes any trailing slashes from the URL. ```xml @@ -101,7 +107,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d ``` -Another example would be to enforce HTTPS only on your site: +Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md). + +### Example: Enforce HTTPS + +The following rule ensures your site only runs on HTTPS: ```xml @@ -114,7 +124,9 @@ Another example would be to enforce HTTPS only on your site: ``` -Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname): +### Example: Redirect Non-www to www + +The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname): ```xml @@ -128,6 +140,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco ``` -{% hint style="warning" %} -If you use **Umbraco Cloud** check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. +### Example: Remove the .aspx Extension + +The following rule redirects `.aspx` URLs to their extensionless counterparts. + +```xml + + + + + + + + + + + + + + + + + +``` + +### Example: Custom Rewrite Rules for Umbraco Cloud + +An example configuration to help ensure your custom rules integrate properly: + +```xml + + + + + + + + + + + + +``` + +{% hint style="info" %} +If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. {% endhint %} diff --git a/13/umbraco-cms/reference/routing/iisrewriterules.md b/13/umbraco-cms/reference/routing/iisrewriterules.md index a05293b530d..8863fb573c9 100644 --- a/13/umbraco-cms/reference/routing/iisrewriterules.md +++ b/13/umbraco-cms/reference/routing/iisrewriterules.md @@ -83,11 +83,17 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar ## Examples of rewrite rules -* A great site showing 10 very handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) +### External Resources + +If you are looking for additional inspiration or examples for creating IIS Rewrite rules, these external resources are a great starting point: + +* A great site showing 10 handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) * Another site showing some handy examples of IIS Rewrite rules: [Some useful IIS rewrite rules](https://odetocode.com/blogs/scott/archive/2014/03/27/some-useful-iis-rewrite-rules.aspx) * If you needed to a lot of static rewrites using rewrite maps: [Rule with rewrite map rule template](https://www.iis.net/learn/extensions/url-rewrite-module/rule-with-rewrite-map-rule-template) -For example, to always remove a trailing slash from the URL (make sure Umbraco doesn't add a trailing slash to all generated URLs by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md)): +### Example: Remove a Trailing Slash + +The following rule removes any trailing slashes from the URL. ```xml @@ -101,7 +107,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d ``` -Another example would be to enforce HTTPS only on your site: +Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md). + +### Example: Enforce HTTPS + +The following rule ensures your site only runs on HTTPS: ```xml @@ -114,7 +124,9 @@ Another example would be to enforce HTTPS only on your site: ``` -Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname): +### Example: Redirect Non-www to www + +The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname): ```xml @@ -128,6 +140,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco ``` -{% hint style="warning" %} -If you use **Umbraco Cloud** check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. +### Example: Remove the .aspx Extension + +The following rule redirects `.aspx` URLs to their extensionless counterparts. + +```xml + + + + + + + + + + + + + + + + + +``` + +### Example: Custom Rewrite Rules for Umbraco Cloud + +An example configuration to help ensure your custom rules integrate properly: + +```xml + + + + + + + + + + + + +``` + +{% hint style="info" %} +If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. {% endhint %} diff --git a/14/umbraco-cms/reference/routing/iisrewriterules.md b/14/umbraco-cms/reference/routing/iisrewriterules.md index a05293b530d..8863fb573c9 100644 --- a/14/umbraco-cms/reference/routing/iisrewriterules.md +++ b/14/umbraco-cms/reference/routing/iisrewriterules.md @@ -83,11 +83,17 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar ## Examples of rewrite rules -* A great site showing 10 very handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) +### External Resources + +If you are looking for additional inspiration or examples for creating IIS Rewrite rules, these external resources are a great starting point: + +* A great site showing 10 handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) * Another site showing some handy examples of IIS Rewrite rules: [Some useful IIS rewrite rules](https://odetocode.com/blogs/scott/archive/2014/03/27/some-useful-iis-rewrite-rules.aspx) * If you needed to a lot of static rewrites using rewrite maps: [Rule with rewrite map rule template](https://www.iis.net/learn/extensions/url-rewrite-module/rule-with-rewrite-map-rule-template) -For example, to always remove a trailing slash from the URL (make sure Umbraco doesn't add a trailing slash to all generated URLs by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md)): +### Example: Remove a Trailing Slash + +The following rule removes any trailing slashes from the URL. ```xml @@ -101,7 +107,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d ``` -Another example would be to enforce HTTPS only on your site: +Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md). + +### Example: Enforce HTTPS + +The following rule ensures your site only runs on HTTPS: ```xml @@ -114,7 +124,9 @@ Another example would be to enforce HTTPS only on your site: ``` -Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname): +### Example: Redirect Non-www to www + +The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname): ```xml @@ -128,6 +140,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco ``` -{% hint style="warning" %} -If you use **Umbraco Cloud** check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. +### Example: Remove the .aspx Extension + +The following rule redirects `.aspx` URLs to their extensionless counterparts. + +```xml + + + + + + + + + + + + + + + + + +``` + +### Example: Custom Rewrite Rules for Umbraco Cloud + +An example configuration to help ensure your custom rules integrate properly: + +```xml + + + + + + + + + + + + +``` + +{% hint style="info" %} +If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. {% endhint %} diff --git a/15/umbraco-cms/reference/routing/iisrewriterules.md b/15/umbraco-cms/reference/routing/iisrewriterules.md index a05293b530d..8863fb573c9 100644 --- a/15/umbraco-cms/reference/routing/iisrewriterules.md +++ b/15/umbraco-cms/reference/routing/iisrewriterules.md @@ -83,11 +83,17 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar ## Examples of rewrite rules -* A great site showing 10 very handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) +### External Resources + +If you are looking for additional inspiration or examples for creating IIS Rewrite rules, these external resources are a great starting point: + +* A great site showing 10 handy IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/) * Another site showing some handy examples of IIS Rewrite rules: [Some useful IIS rewrite rules](https://odetocode.com/blogs/scott/archive/2014/03/27/some-useful-iis-rewrite-rules.aspx) * If you needed to a lot of static rewrites using rewrite maps: [Rule with rewrite map rule template](https://www.iis.net/learn/extensions/url-rewrite-module/rule-with-rewrite-map-rule-template) -For example, to always remove a trailing slash from the URL (make sure Umbraco doesn't add a trailing slash to all generated URLs by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md)): +### Example: Remove a Trailing Slash + +The following rule removes any trailing slashes from the URL. ```xml @@ -101,7 +107,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d ``` -Another example would be to enforce HTTPS only on your site: +Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md). + +### Example: Enforce HTTPS + +The following rule ensures your site only runs on HTTPS: ```xml @@ -114,7 +124,9 @@ Another example would be to enforce HTTPS only on your site: ``` -Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname): +### Example: Redirect Non-www to www + +The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname): ```xml @@ -128,6 +140,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco ``` -{% hint style="warning" %} -If you use **Umbraco Cloud** check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. +### Example: Remove the .aspx Extension + +The following rule redirects `.aspx` URLs to their extensionless counterparts. + +```xml + + + + + + + + + + + + + + + + + +``` + +### Example: Custom Rewrite Rules for Umbraco Cloud + +An example configuration to help ensure your custom rules integrate properly: + +```xml + + + + + + + + + + + + +``` + +{% hint style="info" %} +If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud) article. {% endhint %} diff --git a/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud.md b/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud.md index 73d3688ce8a..1791df7cc40 100644 --- a/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud.md +++ b/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud.md @@ -127,6 +127,25 @@ Another example would be to redirect from non-www to www: Adding the `.azurewebsites.net` pattern is required for the deployment service and the content transfer between environments to continue to function. {% endhint %} +## Custom Rewrite Rules for Umbraco Cloud + +An example configuration to help ensure your custom rules integrate properly: + +```xml + + + + + + + + + + + + +``` + ## Troubleshooting Sometimes, you might experience an issue where a `.azurewebsites.net` link will appear instead of the custom hostname. In this case, a restart will usually fix the issue, however, it is not ideal that this appears at all.