# Redirects

Below are the various redirects you can add within the Site Builder:

* [Site Redirects](#site-redirects) - Redirect other domains/subdomains to your Site
* [Page Redirects](#page-redirects) - Redirect paths within a Site to your Pages
* [Full Path Redirects](#full-path-redirects) - This advanced option allows you to redirect from any path within a Site to anywhere

#### Terminology used in this guide

* **domain/subdomain** - this is the "hostname" part of the URL and is entered without the scheme ("http/https") and without a path after it (example: `www.example.com`)
* **path** - this the part of the URL that is present after the domain and always starts with a slash (example: `/some-path/`)

## Site Redirects

These redirects allow for you to redirect from other domains (i.e. `somesubdomain.example.com`) to the domain of the current Site. This type of redirect is great if you move an entire site from one domain to another as it will redirect all traffic to subpages to the Site's domain. It can also be used to create an "alias" from one domain to another.

You can manage these redirects from the Site Builder under "Site > Settings > Site Redirects"

### Adding the redirect

* **Domain** - Enter the full domain without http/https and without a path at the end (example: *somesubdomain*.example.com)
* **Status** - You have two options on the "Status Code" to return on the redirect. Normally you will want to leave the status as `301`

![](https://825756965-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_zivnvKch6re2urR-L%2F-LxgOfSuemNDsHq-GZhp%2F-LxgPP3ijoAhYczBNnlg%2FScreen%20Shot%202019-12-30%20at%2011.10.50%20AM.png?alt=media\&token=7b16e72d-2293-46b1-9ffa-cbaf92eebb43)

### Example behavior

After this is completed, here are some examples of the behavior:

* `http://somesubdomain.example.com/` -  would redirect to the home page`/` on the Site
* `http://somesubdomain.example.com/any-page-url/` would redirect to `/any-page-url/` on the Site

## Page Redirects

These redirects allow you to redirect from one path within a Site to a specific page within the Site Builder. This type of redirect is typically used to redirect old or deleted page URLs to their new location. These are also preferred compared to "Full Path Redirects" because if you change the Path of the published page, then the old page redirects you have already setup will start redirecting to the new page automatically.

You can manage these redirects from the Site Builder by loading up the page you want to redirect to and then under "Page > Page Options > Page Redirects".

### Adding the redirect

* **Redirect from** - Enter the path (starting with a slash) you want to redirect from (example: `/contact.php`)
* **Status** - You have two options on the "Status Code" to return on the redirect. Normally you will want to leave the status as **301**

![](https://825756965-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_zivnvKch6re2urR-L%2F-LxgOfSuemNDsHq-GZhp%2F-LxgRerqHOXNyi0v8FhK%2FScreen%20Shot%202020-01-03%20at%209.27.13%20AM.png?alt=media\&token=3b87f942-dcf4-49ab-b188-d060c0dfec03)

### Example behavior

* By entering `/contact.php` as the "from", visiting `/contact.php` would redirect to your page's current URL

## Full Path Redirects

These redirects allow you to manually redirect any path within an existing Site to another path or external URL. In most cases it is recommended to use a Page Redirect if possible, but if not then use the Full Path Redirect. This is useful for creating redirects to URLs that do not have a dedicated page like Blog Posts or Product pages within a Site. These redirects can also be used to redirect paths within a Site to external URLs on other domains.

You can manage these redirects from the Site Builder under "Site > Settings > Full Path Redirects"

### Adding the redirect

* **Redirect from** - Enter the path you want to redirect when visited. Start the path with a slash (example: `/contact.php`)
* **Redirect to** - Enter the path (starting with a slash) or enter a full URL (starting with https\://) to the destination page you want to redirect to (example: `/new-contact-page/`)
* **Status** - You have two options on the "Status Code" to return on the redirect. Normally you will want to leave the status as `301`

![](https://825756965-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_zivnvKch6re2urR-L%2F-LxgSrUi6_bE3DZILUai%2F-LxgSxGVj2ytcCYVu2tt%2FScreen%20Shot%202019-12-30%20at%203.10.22%20PM.png?alt=media\&token=5d7d4888-05ad-49e0-94d7-754de66bb441)

### Example behavior

* By entering `/contact.php` as the "from" and `/new-contact-page/` as the "to", visiting `/contact.php` would redirect to `/new-contact-page/` under the Site
* By entering `/contact.php` as the "from" and `https://example.com/new-contact-page/` as the "to", visiting `/contact.php` inside the Site to would redirect to `https://example.com/new-contact-page/` outside of the Site.

## Additional path requirements

### Enter redirect paths without query/tracking parameters

Paths should be entered without query parameters. Query parameters are those values on a URL that start at `?` (question mark) and are separated by `&` (ampersand) symbols

**Example:** the URL of `/about-us?utm_source=google&utm_medium=cpc`

* `/about-us` - This is the path
* `?utm_source=google&utm_medium=cpc` - These are the query parameters

In these cases, you would enter just `/about-us` as the redirect path. If you have multiple redirects with the same path and different URL parameter variations, just enter this redirect once using the path and all will be supported. Then visiting a redirected URL with query parameters, those query parameters are transferred to the resulting page and are not lost.

*Note: Redirecting based on specific matching URL parameters is not supported currently*

## Paths with spaces and URL encoded characters

If you have spaces or other symbols within the path, when visited in the browser you will see the "URL encoded" version of the URL.

**Example:** `/About us.html` will appear as `/About%20us.html` in the URL bar in chrome, regardless of which of these variations you visit.

<figure><img src="https://825756965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_zivnvKch6re2urR-L%2Fuploads%2F9JIvJp80CKFiEQovULgW%2FScreenshot%202024-12-02%20at%203.56.26%E2%80%AFPM.png?alt=media&#x26;token=3c70b7cc-feae-4dd0-908c-ba206ae22eac" alt=""><figcaption></figcaption></figure>

The original (non-URL encoded version) of the path should be entered when adding redirects (i.e. `/About us.html`) in the Path field.

If you have a URL that is already URL encoded and you want to know the non-URL encoded version to enter into DevHub, you can use a tool like [urldecoder.com](https://www.urldecoder.org/)
