How to set up a redirect for your custom domain on Dub.co

Learn how to redirect your custom domain to a URL of your choice on Dub.co.

Steven Tey

Written by Steven Tey

This feature is only available for Pro plans and above.

When you add a custom domain to your workspace, Dub.co will automatically create a placeholder page for your domain. This page will be displayed when you visit your domain.

Placeholder page for a custom domain on Dub.co
Placeholder page for a custom domain on Dub.co

Redirecting your domain

To redirect your domain to a URL of your choice, follow these steps:

  1. If you haven't already, upgrade to the Pro plan.
  2. Navigate to your workspace's Domains page – you can do that by clicking on the Domains link in the menu bar at the top of your workspace dashboard.
  3. Click on the Edit button next to the domain you want to redirect to open up the Domain Settings modal.
  4. Enter the URL you want to redirect your domain to in the Landing Page field.
  5. Click "Save changes".
The 'Domain Settings' modal in Dub.co
The 'Domain Settings' modal in Dub.co

Rewriting your domain (URL masking / cloaking)

In certain cases, you might want to rewrite your domain to a given URL (also known as URL masking or cloaking).

Masking 'youtube.com/@stey' with 'steven.yt'
Masking 'youtube.com/@stey' with 'steven.yt'

You can do that simply by setting the Behavior field of your custom domain to "Rewrite" in the Domain Settings modal:

Setting the behavior of a domain to 'Rewrite'
Setting the behavior of a domain to 'Rewrite'

A few caveats for the URL masking feature:

  1. This feature is only available for Pro plans and above.
  2. URL masking might not work for certain websites that have security measures in place to prevent this (e.g. twitter.com). Potential errors include:
    • The domain redirects instead of rewriting
    • Domain keeps redirecting (ERR_TOO_MANY_REDIRECTS)
  3. For certain Next.js websites, URL masking might cause broken CSS styles (e.g. ray.so)

Did this answer your question?