# Rewrite srcset url's to cdn url

**URL:** https://forum.getkirby.com/t/rewrite-srcset-urls-to-cdn-url/28783
**Category:** Questions
**Tags:** v3
**Created:** [June 9, 2023, 1:55pm UTC](https://forum.getkirby.com/t/rewrite-srcset-urls-to-cdn-url/28783 "2023-06-09T13:55:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Hugo\_S](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/hugo_s/32/13372_2.png) [@Hugo\_S](https://forum.getkirby.com/u/Hugo_S)
#### Post date: [June 9, 2023, 1:55pm UTC](https://forum.getkirby.com/t/rewrite-srcset-urls-to-cdn-url/28783/1 "2023-06-09T13:55:06Z")

</div>

Hello! i can replace file url’s via ‘file::url’, but how do i modify srcset() output from a image object with a plugin?

So $cdnUrl = $cdnOptions.‘./’.$path will convert.

---

<div class="post-metadata">

### Author: ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)
#### Post date: [June 9, 2023, 6:05pm UTC](https://forum.getkirby.com/t/rewrite-srcset-urls-to-cdn-url/28783/2 "2023-06-09T18:05:03Z")

</div>

You also need to modify the file::version component, see our CDN recipe:

> **[Kirby loves CDN](https://getkirby.com/docs/cookbook/extensions/kirby-loves-cdn)**
>
> Set up custom components to deliver assets and files through a CDN.

Since `srcset` uses the thumbs method to create the srcset urls, this will then also fix your `srcset` issue.
