Managing Traffic with Redirects
Redirects allow you to seamlessly route users from one URL to another, ensuring they always reach the correct destination. They are commonly used for:
š Preserving SEO rankings when URLs change.
š Enforcing secure HTTPS connections.
š Directing traffic to localized versions of a site.
š What are the Benefits of Redirects?ā
Redirects help optimize user experience and security by ensuring that visitors always land on the correct and most relevant page.
Key Benefits:
- Ensure Seamless URL Changes: Automatically direct users to new pages when URLs change.
- Enforce HTTPS: Redirect HTTP traffic to secure HTTPS connections.
- Improve SEO & Preserve Link Equity: Avoid broken links that impact search engine rankings.
- Handle Legacy URLs: Maintain compatibility with old URLs or deprecated endpoints.
- Enhance User Experience: Automatically direct visitors to localized or mobile-friendly versions of your site.
Redirect Full Pathā
The following examples showcase how to create an endpoint that redirects requests. The hostname, scheme, and port are kept the same, but the entire path of the request is changed.
- Requests to
https://example-hostname.ngrok.io/example
will be redirected tohttps://example-hostname.ngrok.io/redirect
- Requests to
https://example-hostname.ngrok.io/example/foo
will be redirected tohttps://example-hostname.ngrok.io/redirect
- AgentEndpoint
- CloudEndpoint
- Ingress
- Gateway API
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
š” Ingress resources do not have native redirect capabilities, but they can be extended using a traffic policy. Check out the redirect traffic policy action page for more information about how to customize the parameters.
1. Create an NgrokTrafficPolicy
ā
Loadingā¦
2. Use the NgrokTrafficPolicy
on an Ingress
ā
Loadingā¦
Redirect Path Prefixā
The following examples showcase how to create an endpoint that redirects requests. The hostname, scheme, and port are kept the same, but only the prefix is changed.
- Requests to
https://example-hostname.ngrok.io/example
will be redirected tohttps://example-hostname.ngrok.io/redirect
- Requests to
https://example-hostname.ngrok.io/example/foo
will be redirected tohttps://example-hostname.ngrok.io/redirect/foo
- AgentEndpoint
- CloudEndpoint
- Ingress
- Gateway API
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
š” Ingress resources do not have native redirect capabilities, but they can be extended using a traffic policy. Check out the redirect traffic policy action page for more information about how to customize the parameters.
1. Create an NgrokTrafficPolicy
ā
Loadingā¦
2. Use the NgrokTrafficPolicy
on an Ingress
ā
Loadingā¦
Redirect Portā
The following examples showcase how to create an endpoint that redirects requests. The hostname, scheme, and path are kept the same, but only the port is changed.
- Requests to
http://example-hostname.ngrok.io:8080
will be redirected tohttp://example-hostname.ngrok.io:9090
- AgentEndpoint
- CloudEndpoint
- Ingress
- Gateway API
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
š” Ingress resources do not have native redirect capabilities, but they can be extended using a traffic policy. Check out the redirect traffic policy action page for more information about how to customize the parameters.
1. Create an NgrokTrafficPolicy
ā
Loadingā¦
2. Use the NgrokTrafficPolicy
on an Ingress
ā
Loadingā¦
Redirect Hostnameā
The following examples showcase how to create an endpoint that redirects requests. The scheme, port, and path are kept the same, but only the hostname is changed.
- Requests to
https://example-hostname.ngrok.io
will be redirected tohttps://other-example-hostname.ngrok.io
- AgentEndpoint
- CloudEndpoint
- Ingress
- Gateway API
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
Check out the redirect traffic policy action page for more details about how it functions and the parameters it accepts.
Loadingā¦
š” Ingress resources do not have native redirect capabilities, but they can be extended using a traffic policy. Check out the redirect traffic policy action page for more information about how to customize the parameters.
1. Create an NgrokTrafficPolicy
ā
Loadingā¦
2. Use the NgrokTrafficPolicy
on an Ingress
ā
Loadingā¦