Redirect URLs through one of the following methods:
- Rules: Rules allow you to define how a URL will be redirected through the URL Redirect feature. This feature is especially useful when URL redirects should only occur under specific conditions.
- CDN-as-Code: If you are using CDN-as-code, then you may define URL redirects through the url.url_redirect feature.
- Edge Functions: Edge Functions allow you to intelligently redirect URLS.
- Location Header: Include the
Location
response header within a3xx
response to instruct clients to redirect to a different URL. Alternatively, you can instruct Edgio to follow a redirect defined within aLocation
header provided by the origin through the Follow Redirects feature (follow_redirects). - Bulk Redirects: Use this capability to define a list of URLs for which we will return a
3xx
response with aLocation
header set to the desired URL. In addition to managing URL redirects on an individual basis, you may import and export a list of URL redirects.
Bulk Redirects
This capability allows you to define a list of URLs for which we will return a
3xx
response with a Location
header set to the desired URL. Manage URL redirects on a per environment basis by either manually adding redirect configurations or by importing a CSV file.Key information:
-
Requests are processed in the following order:
- Rules - URL Rewrite & URL Redirect Features: These features take precedence over bulk redirects.
- Bulk Redirects: Bulk redirects take precedence over rules that do not contain the URL Rewrite or the URL Redirect features.
- Rules - Other Features: Once a request is slated for redirection, only features that affect the response can be applied. For example, you may set headers for the
3xx
response sent to the client.
-
Your redirect configuration is excluded from versioning. This allows you to roll back an environment to a previous version without affecting your URL redirects.We strongly recommend that you back up your redirect configuration as a CSV file and place it under source control.
-
For each redirect, you must define a source and a destination.Specify either of the following types of URLs when defining the source and destination:
-
Absolute: Specify the protocol, hostname, and relative path. You may also include a query string.Example:
https://cdn.example.com/conferences/2023
-
Relative: Specify a relative path that starts directly after the hostname. You may also include a query string.Example:
/conferences/2023
-
-
If the requested URL matches the source URL defined within a redirect configuration, we will return a
3xx
response with aLocation
header set to the destination URL. It is up to the client (e.g., web browser) to follow this redirect. -
The source URL must be unique, since we can only redirect a URL to a single location. However, since we support query strings and relative URLs, the requested URL could still potentially match against multiple source URLs. For this reason, Edgio prefers precise source URLs according to the following order:
- Absolute URL with query string
- Absolute URL without query string
- Relative URL with query string
- Relative URL without query string
Edgio will not perform further comparisons once a match is found. This ensures that the request is redirected according to the configuration that is the most precise match. -
Redirecting requests to a relative path may result in an invalid URL when fielding requests from various hostnames. Use an absolute URL to ensure that requests are properly redirected.
-
Define a
3xx
status code for the redirect through the Response status option. By default, we return a301 Moved Permanently
response. -
The Forward query string to redirect location option determines whether the
Location
header will include or exclude the request’s query string. -
You may define up to 10,000 redirects per environment.
-
Once an environment contains 200 or more redirects, you may only manage them by importing CSV file(s).
-
Changes to your redirect configuration will not take effect until the next deployment.
CSV Files
You may import or export a comma-separated values (CSV) file containing a list of redirect configurations.
This CSV file must contain the following header row:
from,to,status,forwardQueryString
These columns are defined below.
- from: Required. Identifies a URL that will be redirected. Specify either an absolute or relative URL.
- to: Required. Identifies the URL to which clients will be redirected. Specify either an absolute or relative URL.
- status: Determines the
3xx
status code for the response sent to the client. Valid values are:301 | 302 | 307 | 308
- forwardQueryString: A Boolean value that determines whether the
Location
response header will include the request’s query string. Valid values are:true | false
Sample CSV:
csvdefault-redirects.csv
1from,to,status,forwardQueryString2/widgets-conference,https://cdn.example.com/conferences/widgets-conference,302,false3https://cdn.example.com/bicycles,/transportation/bicycles,,true4https://cdn.example.com/images,https://cdn.example.com/resources/images,,
Upon importing a CSV file, you may choose whether to replace or append to your existing redirect configuration.
To import redirect configurations (CSV)
-
Navigate to the Redirects page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Redirects.
-
Click Import.
-
Select a CSV file by clicking Browse, navigating to the desired CSV file, selecting it, and then clicking Open.
-
Determine whether you will replace or append to your existing redirect configurations.
-
Replace: Select Override existing list with file content.
-
Append: Select Append file content to existing redirects list.The source URL (
from
) must be unique across all redirect configurations. You will not be allowed to append a CSV file to your existing configuration if doing so will create a redirect configuration with a duplicate source URL.
-
-
Click Upload redirects.
-
If you are finished making changes, click Deploy Now to deploy your changes to this environment.
-
Navigate to the Redirects page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Redirects.
-
Click Export to download a CSV file called
default-redirects.csv
.
Redirect Configuration Administration
You may add, modify, and delete redirect configurations regardless of whether they were added manually or imported from a CSV file.
To add a redirect
-
Navigate to the Redirects page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Redirects.
-
Click Add a redirect.
-
From the Redirect from option, type the URL that will be redirected.
-
From the To option, type the URL to which the
Location
response header will be set. -
Optional. From the Response status option, select the
3xx
status code for the response sent to the client. -
Optional. Mark the Forward query string to redirect location option to allow the request’s query string to be included with the destination URL defined within the
Location
response header.Your redirect configuration should now look similar to the following illustration: -
Click Add a redirect.
-
Repeat steps 2 - 7 as needed.
-
If you are finished making changes, click Deploy Now to deploy your changes to this environment.
To modify a redirect
-
Navigate to the Redirects page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Redirects.
-
Find the desired redirect configuration and then click on it.Use the search field to filter the list to redirect configurations whose source or destination URL matches the specified value.
-
Make the desired changes.
-
Click Save redirect.
-
Repeat steps 2 - 4 as needed.
-
If you are finished making changes, click Deploy Now to deploy your changes to this environment.
To delete a redirect
-
Navigate to the Redirects page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Redirects.
-
Mark each desired redirect.
-
Click Remove selected redirect(s).
-
If you are finished making changes, click Deploy Now to deploy your changes to this environment.