Skip to main content

URL Redirects

The URL Redirects script configures the CacheFly CDN to issue HTTP redirects for specified paths, using the appropriate status codes. Each redirect status code dictates how browsers handle the redirect, thus shaping user experience and technical behavior.

To add a URL Redirects script config to the list of script configs created for your CacheFly services in general, or to associate a URL Redirects script config with a specific CacheFly service, see Adding and Using Script Configs.

Using the URL Redirects Script Config

In general, a URL redirect will cause a user originally connecting to one URL (or URI), to automatically connect instead to a second, different URL (or URI). For example, instead of accessing "/old/path/to/file.jpg", the user may be redirected to access "https://www.example.com/path/to/new/file.jpg".

The original access may be via the HTTP method GET or another ("non-GET") HTTP method such as PUT and POST. In the URL redirect, the HTTP method may be preserved or changed according to the type of redirect, which is in turn specified by the redirect code (HTTP response status code),

Redirect Codes and Usage:

  • 301 Moved Permanently: This code is used for permanent URL changes. For GET methods, the method remains unchanged; other methods may be converted to GET. It is commonly used during the reorganization of a website.

  • 302 Found: Indicates that the URL of the requested resource has been temporarily changed. GET methods remain unchanged; other methods may be converted to GET. Useful when a web page is temporarily unavailable for unforeseen reasons.

  • 303 See Other: Primarily used to redirect after a PUT or POST operation. Ensures that all methods are converted to GET, preventing repeated operations when the user refreshes the result page.

  • 307 Temporary Redirect: Similar to 302 but guarantees that the method and the body of the request are not changed, beneficial when the site offers operations beyond GET.

  • 308 Permanent Redirect: Similar to 301, but it ensures that the method and body of the request are not changed at all, ideal for reorganizing websites while maintaining non-GET links/operations.

Editing the URL Redirects Script Config

When you add the URL Redirects script config to your list of script configs in CacheFly, it will initially display a default configuration as a model for you to adapt to your own requirements.

To edit this default configuration:

  • Click the blue Edit button to enter edit mode

  • Modify the script config as you require

  • Remember to click the blue ✔ Save Changes button to save your changes.

As you edit:

  • The CacheFly system shows on-screen prompts to help you select acceptable parameters and values.

  • The blue ✔ Save Changes button will be partially grayed out and will be inactive, until the system confirms that your edits are acceptable.

  • You can cancel your current edits by clicking the gray Cancel button.

Scroll the graphics in this step horizontally to see all the screens.

Additional Help Topics

As an alternative to creating and managing script configs via the CacheFly user interface as described in this guide, you can also create and manage script configs via API calls.

Click the gray API docs button to access the Script Configs section in CacheFly's online API documentation for further information.