Overview
Custom slugs let you choose your own short code instead of the automatically generated 8-character nanoid. This creates memorable, branded links likeyoursite.com/spring-sale instead of yoursite.com/aB3xY7kL.
Custom slugs are only available to authenticated users. Sign in or create an account to use this feature.
Why Use Custom Slugs?
Custom slugs make your links:- Memorable:
yoursite.com/contactis easier to remember thanyoursite.com/xK9mP2nQ - Branded: Reinforce your brand with recognizable slugs
- Professional: Clean, readable links look more trustworthy
- Campaign-friendly: Track specific campaigns with descriptive slugs like
summer-2024
Creating Links with Custom Slugs
Sign in to your account
Custom slugs require authentication. If you don’t have an account, see the Authentication guide first.
Enter your URL and custom slug
Paste your long URL and enter your desired custom slug in the “Custom slug (optional)” field.
Slug Validation Rules
Custom slugs must follow these requirements:Character Requirements
- Allowed characters: Letters (a-z, A-Z), numbers (0-9), hyphens (
-), and underscores (_) - Length: 1 to 20 characters
- No spaces: Use hyphens or underscores instead
Valid Examples
spring-salecontact_us2024promoq1-reportbeta
Invalid Examples
| Slug | Reason | Fix |
|---|---|---|
my slug | Contains spaces | Use my-slug or my_slug |
special! | Invalid character ! | Use only letters, numbers, -, _ |
this-is-a-very-long-slug-name | Over 20 characters | Shorten to 20 characters or less |
| “ (empty) | No characters | Provide at least 1 character |
api | Reserved route | Choose a different slug |
If your slug is invalid, you’ll receive the error: “Invalid slug: use letters, numbers, _ and - only (1–20 chars)”.
Reserved Slugs
Certain slugs are reserved for application routes and cannot be used:apishortenloginregisterdashboard_nextfavicon.ico
Uniqueness Checking
shrtnr ensures every custom slug is unique:- Before creating a link, the database is checked for existing slugs
- If the slug already exists, creation fails with “Slug already in use”
- Slugs are case-sensitive:
MyLinkandmylinkare different
Editing Custom Slugs
You can change your custom slug after creation:Open the dashboard
Navigate to your dashboard (see Dashboard guide) to see all your links.
When you edit a slug, the old short link stops working immediately. Anyone using the old link will get a 404 error.
Converting Auto-Generated Links
You can convert an automatically generated short code to a custom slug:- Create a link without a custom slug (get the 8-character nanoid)
- Open the link in your dashboard
- Click Edit and enter your custom slug
- Save - your link now uses the custom slug
Cache Invalidation
When you create or update a custom slug, shrtnr automatically invalidates the Redis cache:- Old slug cache entry is deleted
- New slug cache is populated on first use
- Ensures redirects always use the latest configuration
Best Practices
Custom Slug Guidelines
Do:
- Use descriptive, memorable names
- Keep slugs short and simple
- Use hyphens for readability (
spring-salenotspringsale) - Match campaign names for easy tracking
- Test that your slug isn’t already taken
- Use random or meaningless combinations
- Make slugs too long (aim for under 15 characters)
- Include spaces or special characters
- Use reserved route names
- Change slugs for widely-distributed links
Common Errors
”Sign in to use a custom slug”
You tried to create a custom slug as a guest user. Solution: See the Authentication guide to sign in or create an account.”Slug already in use”
Another link (yours or someone else’s) is already using this slug. Solution: Choose a different slug. Try adding a number or year:promo → promo-2024.
”Invalid slug: use letters, numbers, _ and - only (1–20 chars)”
Your slug contains invalid characters or is too long. Solution: Remove special characters, spaces, or shorten to 20 characters max.Examples
Marketing Campaign
Event Registration
Social Media Bio
Related Features
- URL Shortening - Learn the basics of creating short links
- Dashboard - Manage and edit your custom slugs
- Analytics - Track performance of your custom links
- Link Expiration - Set expiration times for custom links