Skip to content

Commit c0afe2d

Browse files
authored
Merge pull request #7329 from umbraco/Rewrite-rules
Added an example for serving files from .well-known path
2 parents 0b21ce0 + ad83e83 commit c0afe2d

File tree

7 files changed

+112
-6
lines changed

7 files changed

+112
-6
lines changed

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,40 @@ An example configuration to help ensure your custom rules integrate properly:
184184
```
185185

186186
{% hint style="info" %}
187-
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.
187+
If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/go-live/manage-hostnames/rewrites-on-cloud) article.
188+
{% endhint %}
189+
190+
### Example: Serving Files from the `.well-known` Path
191+
192+
Some third-party services such as Apple Pay, Google, or other integrations, require you to host a verification file at a specific URL like:
193+
194+
```text
195+
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
196+
```
197+
198+
On Umbraco Cloud, directly hosting files in the `.well-known` folder (for example, via Git or Kudu) may result in a 404 error due to platform restrictions.
199+
200+
To work around this, you can serve the required file using Umbraco's **Media** library along with an IIS rewrite rule.
201+
202+
To do so, follow these steps:
203+
204+
1. Go to the **Media** section in the Umbraco backoffice.
205+
2. Create a folder named `.well-known`.
206+
This folder is only for your own organization. It does not affect the public file URL.
207+
3. Upload the verification file. For example: *test.txt*.
208+
209+
![Uploading Verification file in the Backoffice](images/upload-verification-file.png)
210+
211+
4. Copy the Media file URL. For example, `/media/4jhhlmxk/verification.txt`.
212+
5. Add a rewrite rule in your `web.config` file:
213+
214+
```xml
215+
<rule xdt:Transform="Insert" name="Rewrite Apple Developer Merchant ID" stopProcessing="true">
216+
<match url="^\.well-known/apple-developer-merchantid-domain-association$" />
217+
<action type="Rewrite" url="/media/4jhhlmxk/test.txt" />
218+
</rule>
219+
```
220+
221+
{% hint style="info" %}
222+
Replace the `match` and `url` values with your specific Media path and verification filename.
188223
{% endhint %}
64.4 KB
Loading

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,40 @@ An example configuration to help ensure your custom rules integrate properly:
184184
```
185185

186186
{% hint style="info" %}
187-
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.
187+
If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/go-live/manage-hostnames/rewrites-on-cloud) article.
188+
{% endhint %}
189+
190+
### Example: Serving Files from the `.well-known` Path
191+
192+
Some third-party services such as Apple Pay, Google, or other integrations, require you to host a verification file at a specific URL like:
193+
194+
```text
195+
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
196+
```
197+
198+
On Umbraco Cloud, directly hosting files in the `.well-known` folder (for example, via Git or Kudu) may result in a 404 error due to platform restrictions.
199+
200+
To work around this, you can serve the required file using Umbraco's **Media** library along with an IIS rewrite rule.
201+
202+
To do so, follow these steps:
203+
204+
1. Go to the **Media** section in the Umbraco backoffice.
205+
2. Create a folder named `.well-known`.
206+
This folder is only for your own organization. It does not affect the public file URL.
207+
3. Upload the verification file. For example: *test.txt*.
208+
209+
![Uploading Verification file in the Backoffice](images/upload-verification-file.png)
210+
211+
4. Copy the Media file URL. For example, `/media/4jhhlmxk/verification.txt`.
212+
5. Add a rewrite rule in your `web.config` file:
213+
214+
```xml
215+
<rule xdt:Transform="Insert" name="Rewrite Apple Developer Merchant ID" stopProcessing="true">
216+
<match url="^\.well-known/apple-developer-merchantid-domain-association$" />
217+
<action type="Rewrite" url="/media/4jhhlmxk/test.txt" />
218+
</rule>
219+
```
220+
221+
{% hint style="info" %}
222+
Replace the `match` and `url` values with your specific Media path and verification filename.
188223
{% endhint %}
64.4 KB
Loading

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,40 @@ An example configuration to help ensure your custom rules integrate properly:
184184
```
185185

186186
{% hint style="info" %}
187-
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.
187+
If you use **Umbraco Cloud**, check the [Rewrite Rules](https://docs.umbraco.com/umbraco-cloud/go-live/manage-hostnames/rewrites-on-cloud) article.
188+
{% endhint %}
189+
190+
### Example: Serving Files from the `.well-known` Path
191+
192+
Some third-party services such as Apple Pay, Google, or other integrations, require you to host a verification file at a specific URL like:
193+
194+
```text
195+
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
196+
```
197+
198+
On Umbraco Cloud, directly hosting files in the `.well-known` folder (for example, via Git or Kudu) may result in a 404 error due to platform restrictions.
199+
200+
To work around this, you can serve the required file using Umbraco's **Media** library along with an IIS rewrite rule.
201+
202+
To do so, follow these steps:
203+
204+
1. Go to the **Media** section in the Umbraco backoffice.
205+
2. Create a folder named `.well-known`.
206+
This folder is only for your own organization. It does not affect the public file URL.
207+
3. Upload the verification file. For example: *test.txt*.
208+
209+
![Uploading Verification file in the Backoffice](images/upload-verification-file.png)
210+
211+
4. Copy the Media file URL. For example, `/media/4jhhlmxk/verification.txt`.
212+
5. Add a rewrite rule in your `web.config` file:
213+
214+
```xml
215+
<rule xdt:Transform="Insert" name="Rewrite Apple Developer Merchant ID" stopProcessing="true">
216+
<match url="^\.well-known/apple-developer-merchantid-domain-association$" />
217+
<action type="Rewrite" url="/media/4jhhlmxk/test.txt" />
218+
</rule>
219+
```
220+
221+
{% hint style="info" %}
222+
Replace the `match` and `url` values with your specific Media path and verification filename.
188223
{% endhint %}
64.4 KB
Loading

umbraco-cloud/go-live/manage-hostnames/rewrites-on-cloud.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ The rewrite rules should be added to the `<system.webServer><rewrite>` module in
2020

2121
## Best practices
2222

23-
When you are doing rewrite rules on Umbraco Cloud there are a few important things to keep in mind:
23+
When setting up rewrite rules on Umbraco Cloud, there are a few important things to keep in mind:
2424

25-
* Always make sure that you add a condition that negates the Umbraco Backoffice - `/umbraco`, otherwise, you will not be able to do deployments to/from the environment
26-
* To be able to continue working locally with your Umbraco Cloud project, you also need to add a condition that negates `localhost`
25+
* Always include a condition to exclude the Umbraco backoffice path (`/umbraco`). Failing to do so may prevent you from deploying to and from the environment.
26+
* To continue working locally with your Umbraco Cloud project, you should also add a condition to exclude `localhost`.
27+
* To serve verification files from the `.well-known` directory (for example, Apple Pay or Google), follow the [Rewrite rule workaround in the CMS documentation](https://docs.umbraco.com/umbraco-cms/reference/routing/iisrewriterules#example-serving-files-from-the-well-known-path).
2728

2829
## Hiding the default umbraco.io URL
2930

0 commit comments

Comments
 (0)