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.
The
_redirectsfile already exists in the AsyncAPI website repository underpublic/_redirects.
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/_redirectsHow Redirects Are Processed
Netlify reads the _redirects file top to bottom, and applies the first matching rule. Because of this, the order of rules matters.
Defining a Short URL Rule
Each short URL must begin with /s/ to ensure there is no conflict with existing site paths. Write each redirect rule on a single line, with space-separated values:
/s/short-path https://destination.url statusWhich Status Code to Use?
- 301 (Permanent): Use when the short link is intended to remain unchanged.
- 302 (Temporary): Use when the short link 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
Follow these steps to add a new redirect rule for the AsyncAPI website:
Step 1: Open the _redirects file
Navigate to the public/_redirects file in the AsyncAPI website repository.
Step 2: Add your redirect rule
Add a new redirect rule on a separate line.
You may include a comment above the rule for clarity:
1# Permanent redirect to the main Studio app
2/s/studio https://studio.asyncapi.com/ 301Step 3: 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.
Step 4: Document the change in the PR
In your PR description, mention:
- The added short URL path
- Destination URL
- Why the short link was needed
This ensures reviewers understand the context and purpose of the redirect.
By following this guide, you help maintain consistency and improve navigation for the AsyncAPI community through clean, memorable short URLs using the /s/ path.