How to Redirect Default Netlify Subdomain to Custom Domain

When you add custom domain to your netlify app, the [your].netlify.app not automatically redirect to your custom domain.

To redirect default netlify subdomain to your custom domain, add new file _redirects and save to the root of your website, then fill the _redirects file with the code below.

# Redirect default Netlify subdomain to primary domain

https://[your].netlify.app/* https://[your-domain].com/:splat 301!

# Example: https://budi.netlify.app/* https://budidev.com/:splat 301!

In Hugo, save _redirects file to static folder.

#domain   #netlify   #hugo