Skip to content

Commit beb5029

Browse files
committed
Incoproated suggestions
1 parent 81f2470 commit beb5029

File tree

5 files changed

+193
-31
lines changed

5 files changed

+193
-31
lines changed

10/umbraco-cms/reference/routing/iisrewriterules.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar
8787
* 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)
8888
* 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)
8989

90-
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)):
90+
### Example: Remove a Trailing Slash
91+
92+
The following rule removes any trailing slashes from the URL.
9193

9294
```xml
9395
<rule name="Remove trailing slash" stopProcessing="true">
@@ -101,7 +103,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d
101103
</rule>
102104
```
103105

104-
Another example would be to enforce HTTPS only on your site:
106+
Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md).
107+
108+
### Example: Enforce HTTPS
109+
110+
The following rule ensures your site only runs on HTTPS:
105111

106112
```xml
107113
<rule name="Redirect to HTTPS" stopProcessing="true">
@@ -114,7 +120,9 @@ Another example would be to enforce HTTPS only on your site:
114120
</rule>
115121
```
116122

117-
Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname):
123+
### Example: Redirect Non-www to www
124+
125+
The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname):
118126

119127
```xml
120128
<rule name="Redirect to www prefix" stopProcessing="true">
@@ -128,6 +136,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco
128136
</rule>
129137
```
130138

131-
{% hint style="warning" %}
132-
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.
139+
### Example: Remove the .aspx Extension
140+
141+
The following rule redirects `.aspx` URLs to their extensionless counterparts.
142+
143+
```xml
144+
<configuration>
145+
<system.webServer>
146+
<rewrite>
147+
<rules>
148+
<!-- Redirect .aspx URLs to their extensionless counterparts -->
149+
<rule name="Remove ASPX extension" stopProcessing="true">
150+
<match url="^(.*)\.aspx$" />
151+
<conditions logicalGrouping="MatchAll">
152+
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
153+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
154+
</conditions>
155+
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
156+
</rule>
157+
</rules>
158+
</rewrite>
159+
</system.webServer>
160+
</configuration>
161+
```
162+
163+
### Example: Custom Rewrite Rules for Umbraco Cloud
164+
165+
An example configuration to help ensure your custom rules integrate properly:
166+
167+
```xml
168+
<?xml version="1.0" encoding="utf-8"?>
169+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
170+
<location path="." inheritInChildApplications="false">
171+
<system.webServer>
172+
<rewrite xdt:Transform="Insert">
173+
<rules>
174+
<!-- Add your custom rules here -->
175+
</rules>
176+
</rewrite>
177+
</system.webServer>
178+
</location>
179+
</configuration>
180+
```
181+
182+
{% hint style="info" %}
183+
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.
133184
{% endhint %}

13/umbraco-cms/reference/routing/iisrewriterules.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar
8787
* 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)
8888
* 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)
8989

90-
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)):
90+
### Example: Remove a Trailing Slash
91+
92+
The following rule removes any trailing slashes from the URL.
9193

9294
```xml
9395
<rule name="Remove trailing slash" stopProcessing="true">
@@ -101,7 +103,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d
101103
</rule>
102104
```
103105

104-
Another example would be to enforce HTTPS only on your site:
106+
Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md).
107+
108+
### Example: Enforce HTTPS
109+
110+
The following rule ensures your site only runs on HTTPS:
105111

106112
```xml
107113
<rule name="Redirect to HTTPS" stopProcessing="true">
@@ -114,7 +120,9 @@ Another example would be to enforce HTTPS only on your site:
114120
</rule>
115121
```
116122

117-
Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname):
123+
### Example: Redirect Non-www to www
124+
125+
The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname):
118126

119127
```xml
120128
<rule name="Redirect to www prefix" stopProcessing="true">
@@ -128,6 +136,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco
128136
</rule>
129137
```
130138

131-
{% hint style="warning" %}
132-
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.
139+
### Example: Remove the .aspx Extension
140+
141+
The following rule redirects `.aspx` URLs to their extensionless counterparts.
142+
143+
```xml
144+
<configuration>
145+
<system.webServer>
146+
<rewrite>
147+
<rules>
148+
<!-- Redirect .aspx URLs to their extensionless counterparts -->
149+
<rule name="Remove ASPX extension" stopProcessing="true">
150+
<match url="^(.*)\.aspx$" />
151+
<conditions logicalGrouping="MatchAll">
152+
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
153+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
154+
</conditions>
155+
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
156+
</rule>
157+
</rules>
158+
</rewrite>
159+
</system.webServer>
160+
</configuration>
161+
```
162+
163+
### Example: Custom Rewrite Rules for Umbraco Cloud
164+
165+
An example configuration to help ensure your custom rules integrate properly:
166+
167+
```xml
168+
<?xml version="1.0" encoding="utf-8"?>
169+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
170+
<location path="." inheritInChildApplications="false">
171+
<system.webServer>
172+
<rewrite xdt:Transform="Insert">
173+
<rules>
174+
<!-- Add your custom rules here -->
175+
</rules>
176+
</rewrite>
177+
</system.webServer>
178+
</location>
179+
</configuration>
180+
```
181+
182+
{% hint style="info" %}
183+
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.
133184
{% endhint %}

14/umbraco-cms/reference/routing/iisrewriterules.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar
8787
* 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)
8888
* 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)
8989

90-
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)):
90+
### Example: Remove a Trailing Slash
91+
92+
The following rule removes any trailing slashes from the URL.
9193

9294
```xml
9395
<rule name="Remove trailing slash" stopProcessing="true">
@@ -101,7 +103,11 @@ For example, to always remove a trailing slash from the URL (make sure Umbraco d
101103
</rule>
102104
```
103105

104-
Another example would be to enforce HTTPS only on your site:
106+
Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md).
107+
108+
### Example: Enforce HTTPS
109+
110+
The following rule ensures your site only runs on HTTPS:
105111

106112
```xml
107113
<rule name="Redirect to HTTPS" stopProcessing="true">
@@ -114,7 +120,9 @@ Another example would be to enforce HTTPS only on your site:
114120
</rule>
115121
```
116122

117-
Another example would be to redirect from non-www to www (except for the Umbraco Cloud project hostname):
123+
### Example: Redirect Non-www to www
124+
125+
The following rule redirects traffic from non-www to www (excluding the Umbraco Cloud project hostname):
118126

119127
```xml
120128
<rule name="Redirect to www prefix" stopProcessing="true">
@@ -128,6 +136,49 @@ Another example would be to redirect from non-www to www (except for the Umbraco
128136
</rule>
129137
```
130138

131-
{% hint style="warning" %}
132-
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.
139+
### Example: Remove the .aspx Extension
140+
141+
The following rule redirects `.aspx` URLs to their extensionless counterparts.
142+
143+
```xml
144+
<configuration>
145+
<system.webServer>
146+
<rewrite>
147+
<rules>
148+
<!-- Redirect .aspx URLs to their extensionless counterparts -->
149+
<rule name="Remove ASPX extension" stopProcessing="true">
150+
<match url="^(.*)\.aspx$" />
151+
<conditions logicalGrouping="MatchAll">
152+
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
153+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
154+
</conditions>
155+
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
156+
</rule>
157+
</rules>
158+
</rewrite>
159+
</system.webServer>
160+
</configuration>
161+
```
162+
163+
### Example: Custom Rewrite Rules for Umbraco Cloud
164+
165+
An example configuration to help ensure your custom rules integrate properly:
166+
167+
```xml
168+
<?xml version="1.0" encoding="utf-8"?>
169+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
170+
<location path="." inheritInChildApplications="false">
171+
<system.webServer>
172+
<rewrite xdt:Transform="Insert">
173+
<rules>
174+
<!-- Add your custom rules here -->
175+
</rules>
176+
</rewrite>
177+
</system.webServer>
178+
</location>
179+
</configuration>
180+
```
181+
182+
{% hint style="info" %}
183+
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.
133184
{% endhint %}

15/umbraco-cms/reference/routing/iisrewriterules.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,14 @@ For more details and other examples, take a look at the [URL Rewriting Middlewar
8383

8484
## Examples of rewrite rules
8585

86-
Below are some handy IIS Rewrite Rules you can use in your projects:
87-
88-
* **10 Handy IIS Rewrite Rules**
89-
90-
A great resource showcasing 10 practical IIS Rewrite rules: [URL rewriting tips and tricks](https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/)
91-
92-
* **Examples of IIS Rewrite Rules**
93-
94-
Another useful collection of IIS rewrite rule examples: [Some useful IIS rewrite rules](https://odetocode.com/blogs/scott/archive/2014/03/27/some-useful-iis-rewrite-rules.aspx)
95-
96-
* **Static Rewrites Using Rewrite Maps**
97-
98-
If you need to handle a lot of static rewrites, consider using rewrite maps: [Rule with rewrite map rule template](https://www.iis.net/learn/extensions/url-rewrite-module/rule-with-rewrite-map-rule-template)
86+
* 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/)
87+
* 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)
88+
* 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)
9989

10090
### Example: Remove a Trailing Slash
10191

10292
The following rule removes any trailing slashes from the URL.
10393

104-
Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md).
105-
10694
```xml
10795
<rule name="Remove trailing slash" stopProcessing="true">
10896
<match url="(.*)/+$" />
@@ -115,6 +103,8 @@ Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `f
115103
</rule>
116104
```
117105

106+
Ensure Umbraco does not add a trailing slash by setting `AddTrailingSlash` to `false` in your [RequestHandler settings](../configuration/requesthandlersettings.md).
107+
118108
### Example: Enforce HTTPS
119109

120110
The following rule ensures your site only runs on HTTPS:
@@ -148,7 +138,7 @@ The following rule redirects traffic from non-www to www (excluding the Umbraco
148138

149139
### Example: Remove the .aspx Extension
150140

151-
The following rule redirects `.aspx` URLs to their extensionless counterparts. Make sure you also have a `web.config` file in the root of your site.
141+
The following rule redirects `.aspx` URLs to their extensionless counterparts.
152142

153143
```xml
154144
<configuration>

umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,25 @@ Another example would be to redirect from non-www to www:
123123
</rule>
124124
```
125125

126+
## Custom Rewrite Rules for Umbraco Cloud
127+
128+
An example configuration to help ensure your custom rules integrate properly:
129+
130+
```xml
131+
<?xml version="1.0" encoding="utf-8"?>
132+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
133+
<location path="." inheritInChildApplications="false">
134+
<system.webServer>
135+
<rewrite xdt:Transform="Insert">
136+
<rules>
137+
<!-- Add your custom rules here -->
138+
</rules>
139+
</rewrite>
140+
</system.webServer>
141+
</location>
142+
</configuration>
143+
```
144+
126145
{% hint style="warning" %}
127146
Adding the `.azurewebsites.net` pattern is required for the deployment service and the content transfer between environments to continue to function.
128147
{% endhint %}

0 commit comments

Comments
 (0)