Introduction
Short URLs make it easier for users to access commonly shared AsyncAPI resources (e.g., asyncapi.com/slack instead of long invite links). To avoid conflicts with existing routes (like /docs, /community, etc.), all short URLs must use the /s/ path prefix. These short links are powered by Netlify server-side redirects using the _redirects file, ensuring fast, reliable, and CDN-level redirection.
Understanding the _redirects file
The _redirects file is a plain text file that defines redirect rules for the AsyncAPI website. Netlify uses this file during deployment and applies the redirects at the CDN (edge) level, meaning the redirect occurs before the page loads, ensuring high performance and a better user experience.
File Location
For the AsyncAPI website, the _redirects file is located at: public/_redirects
How Redirects Are Processed
Netlify reads the _redirects file top to bottom and applies the first matching rule, so the order of rules matters.
Defining a Short URL Rule
Each short URL must start with /s/ to avoid conflicts with existing site paths. Write each redirect rule on a single line, with space-separated values:
/s/short-path https://destination.url statusWhere status can have one of the following values:
- 301: Permanent - for links that remain unchanged.
- 302: Temporary - for links that may change in the future.
Examples
1/s/slack-invite https://asyncapi.com/slack 302
2/s/modelina /tools/modelina 301
3/s/github https://github.com/asyncapi 301Steps to Add a New Short URL
-
Navigate to the
public/_redirectsfile in the AsyncAPI website repository. -
Add a new redirect rule on a separate line. You may include a comment above the rule for clarity. For example:
1# Permanent redirect to the main Studio app 2/s/asyncapiv2 https://raw.githubusercontent.com/asyncapi/asyncapi/2.0.0/examples/2.0.0/streetlights.yml 301 -
Commit and create a Pull Request
- Commit the updated
_redirectsfile to your branch. - Push your changes to GitHub.
- Raise a Pull Request.
- Deploy Preview will be generated for the PR use it to validate your redirect.
- Commit the updated
-
Document the change in the PR. In your PR description, add context to ensure reviewers understand the purpose of the redirect:
- The added short URL path
- Destination URL
- The purpose of the short link