# Rewrite Origin URLs

**Rewrite Origin URLs** enables you to transform incoming paths before they are forwarded to origin servers. You can configure **Match Mode**, **Origin URI**, **Target URI**, and **Priority** to adjust how paths are rewritten for directory changes, API restructuring, or backend routing needs.

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

In the Medianova Control Panel, go to **CDN Resources**, select your resource, and navigate to **Origin Settings**

## Manage Rewrite Origin URLs

Follow the steps below to add and manage Rewrite Origin URLs for your CDN Resource.

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2FSSXhuMyQrgmToZbft6Sy%2FEkran%20Resmi%202024-12-11%2013.45.14.png?alt=media&#x26;token=d52e89da-331d-4ae8-8be0-f4081f48716b" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}
**Add a Rewrite Origin URL**

Select **Add** to create a new Rewrite Origin URL.

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2FfLkgyDzlP6K6yJzeuLMh%2FEkran%20Resmi%202024-12-11%2013.45.53.png?alt=media&#x26;token=a7bb9a14-8381-498e-bb18-59354dbc9de6" alt="" width="563"><figcaption></figcaption></figure>

The Add Rewrite Origin URL popup appears.
{% endstep %}

{% step %}
**Configure Parameters**

Fill in the required fields in the popup:

* **Match Mode** — Choose how the incoming path is matched.\
  Options include:
  * `All files`
  * `Path`
  * `Full Path`
  * `Wildcard`
* **Origin URI** — Enter the incoming request path to match.
* **Target URI** — Enter the new path that requests will be rewritten to.
* **Priority** — Lower values are evaluated first when multiple Rewrite Origin URLs exist.
  {% endstep %}

{% step %}
**Save the Configuration**

Select **Add**, then click **Submit**.\
Your Rewrite Origin URL is added to the list.
{% endstep %}
{% endstepper %}

### **Match Mode Behavior**

* **All files**: Applies to every incoming request.
* **Path**: Matches only the path portion of the request URI.
* **Full Path**: Matches the exact full URL path.
* **Wildcard**: Enables dynamic pattern matching using wildcard symbols.

## **Troubleshooting**

**Issue:** Rewrite Origin URL does not apply.\
**Cause:** Incorrect Match Mode or Origin URI format.\
**Fix:** Verify that the incoming request path matches the defined parameters.

**Issue:** A different Rewrite Origin URL is applied first.\
**Cause:** Priority ordering conflict.\
**Fix:** Assign a lower priority value to the entry you want processed first.

**Issue:** Origin returns 404 after rewrite.\
**Cause:** Target URI does not exist on the origin.\
**Fix:** Confirm that the target path is valid and reachable at the origin server.
