Skip to main content
urlTransform rewrites the public URL the plugin generates for a file — add query parameters, a cache-busting timestamp, or take full control with a custom function.
payload.config.ts
urlTransform takes one of four forms:
  • false (default): no transform.
  • true: on a collection, use the global urlTransform. At the top level it changes nothing.
  • An object: appendTimestamp and queryParams.
  • A function: you build the URL yourself. See Custom transform function.

Simple transform

Custom transform function

For full control, pass a function as urlTransform. It replaces appendTimestamp and queryParams — you build the URL yourself.
The function receives: Return the final URL string.

What baseUrl is

urlTransform runs in both access-control modes — it always rewrites the url field. What changes is the base URL it starts from, which matters when you write a transform function:

Collection overrides

A collection object merges field by field onto a global object. A collection function replaces a global object, and a collection object replaces a global function. See Collection overrides for the full list of options you can tune per collection, and Thumbnails for the equivalent transform on thumbnail URLs.