How to Customize the URL for a Media Asset

Butter hosts your files in our Media Library, therefore all of the files you choose to upload into your ButterCMS account will have a ButterCMS CDN URL. Files in the Media Library are assigned a random CDN URL slug so that each asset on our CDN has its own unique URL.

A URL on your site (Eg: https://mywebsite.com/HeadlessCMSvsTraditionalCMS.pdf) cannot link to your file in ButterCMS (Eg: https://cdn.buttercms.com/Cw5z1qzSq5qtVMCbUDwQ) since that asset resides on your domain. If you want to redirect the URL for an asset stored in your ButterCMS media library, you would need to set up a URL route in your web application that is hardcoded to load up the end asset in ButterCMS.

If you want to be able to set up multiple redirects in ButterCMS you can follow these steps:

  1. Create a "Resources" Collection in ButterCMS. It should have a "Name" short text field and "Resource" media field.
  2. Your application will need to set up a new route to support files like mywebsite.com/files/<resource-name>/
  3. App will grab the resource name slug off of the URL and use that to query the ButterCMS Resource Collection to look up the associated asset to serve to the user.
  4. App will then proxy the user to the final resource (which lives on cdn.buttercms.com) and is returned via the Butter API

Still have a question?

Our Customer Success team is standing by to help.