> For the complete documentation index, see [llms.txt](https://clients.medianova.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clients.medianova.com/products/performance-cdn/static-content-delivery/advanced-configuration/origin-settings/rewrite-origin-urls.md).

# Rewrite Origin URLs

Configure Rewrite Origin URLs to modify request paths before forwarding requests to the origin server.

**Rewrite Origin URLs** allows you to replace an incoming request URI with a specified destination URI. Rules can apply to all requests or to requests matching a specific path pattern. The rewrite affects the request sent to the origin without changing the client-facing URL.

You can manage rewrite rules through the [Medianova Control Panel](https://cloud.medianova.com) or the [Origin Settings API](https://clients.medianova.com/api-documentation/performance-cdn/origin-settings#put-api-v1-cdn-organization_uuid-resource-resource_uuid-2).

{% hint style="info" %}
**Origin Settings** is available for CDN Resources that use **My origin** as the content source. This section is not displayed when **Object storage** is selected.
{% endhint %}

## Configure a Rewrite Rule

{% stepper %}
{% step %}

### Open Origin Settings

Open your CDN Resource and select **Origin Settings**.
{% endstep %}

{% step %}

### Add a Rewrite Rule

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2FW9dUM73oOlDo6Y1PZVlf%2Fimage.png?alt=media&amp;token=d7881bb3-e8e1-4db0-9fbc-8aa4729f5248" alt=""><figcaption><p>Add a Rewrite Rule</p></figcaption></figure>

In **Rewrite Origin Urls**, select **Add rewrite rule**.
{% endstep %}

{% step %}

### Select the Match Mode

Select how incoming requests are matched:

* **All Files** – Applies the rewrite rule to all requests.
* **Path** – Matches requests based on a specified path.
* **Full Path** – Matches requests based on the complete path.
* **Wildcard** – Matches requests using a wildcard pattern.
  {% endstep %}

{% step %}

### Configure the Rewrite

Enter the values for the rewrite rule:

* **Match With** – Specify the incoming request URI or path pattern to match.
* **Replace To** – Specify the URI to use when forwarding matching requests to the origin.

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2FbF9lCZqreq01RJI2qmH8%2Fimage.png?alt=media&amp;token=cdd54a65-4db4-45de-a22a-f2480e7a10a4" alt=""><figcaption><p>Configure the Rewrite</p></figcaption></figure>
{% endstep %}

{% step %}

### Add the Rewrite Rule

Select **Add rewrite rule** to add the rule to the **Rewrite Origin Urls** list.
{% endstep %}

{% step %}

### Save the Configuration

Select **Save** in the pending changes bar.

Review the pending changes and confirm the update to apply the configuration to the CDN Resource.
{% endstep %}
{% endstepper %}

## Manage Rewrite Rules

Configured rules appear in the **Rewrite Origin Urls** table with the following columns:

<table><thead><tr><th width="261">Column</th><th>Description</th></tr></thead><tbody><tr><td><strong>Match mode</strong></td><td>The matching method used by the rule.</td></tr><tr><td><strong>Match With</strong></td><td>The incoming request URI or path pattern to match.</td></tr><tr><td><strong>Replace To</strong></td><td>The URI used for matching requests forwarded to the origin.</td></tr><tr><td><strong>Priority</strong></td><td>The rule's evaluation priority.</td></tr></tbody></table>

Use the available actions to edit or remove a rule.

After making changes, select **Save** in the pending changes bar and confirm the update.

## Rewrite Behavior

When an incoming request matches a configured rewrite rule, the CDN replaces the request URI according to the **Replace To** value before forwarding the request to the origin server.

The rewrite affects only the origin request. The URL requested by the client remains unchanged.

Rules are evaluated by priority, with lower numeric values processed first.

{% hint style="info" %}
Incorrect match conditions, replacement paths, or rule priorities may result in unexpected origin routing or HTTP 404 responses.
{% endhint %}

## Troubleshooting

If a rewrite rule does not produce the expected result:

* **Match Mode** – Verify that the selected matching method corresponds to the incoming request URI.
* **Match With** – Confirm that the specified URI or path pattern matches the intended requests.
* **Replace To** – Verify that the replacement URI corresponds to a valid path on the origin server.
* **Priority** – If multiple rules could match the same request, review their evaluation order in the **Rewrite Origin Urls** table.
* **Pending changes** – Confirm that the configuration has been saved and applied to the CDN Resource.

## Related Concepts

* [Advanced Origin Settings](https://clients.medianova.com/products/performance-cdn/static-content-delivery/advanced-configuration/origin-settings/advanced-origin-settings.md)
* [Origin SNI Request](https://clients.medianova.com/products/performance-cdn/static-content-delivery/advanced-configuration/origin-settings/origin-sni-request.md)
* [Origin Settings API](https://clients.medianova.com/api-documentation/performance-cdn/origin-settings)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://clients.medianova.com/products/performance-cdn/static-content-delivery/advanced-configuration/origin-settings/rewrite-origin-urls.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
