# Url not from media folder?

**URL:** <https://forum.getkirby.com/t/url-not-from-media-folder/21486>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 6, 2021, 6:24pm UTC](https://forum.getkirby.com/t/url-not-from-media-folder/21486 "2021-03-06T18:24:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [March 7, 2021, 12:17am UTC](https://forum.getkirby.com/t/url-not-from-media-folder/21486/3 "2021-03-07T00:17:51Z")

</div>

Something like this will do it:

```auto
'components' => [
    'file::url' => function (Kirby $kirby, $file) {
      $page = $file->parent();
      if ($file->extension() == 'pdf') {
        return $kirby->url() . '/content/' . $page->diruri() . '/' . $file->filename();
      } else {
        return $file->mediaurl();
      }
    }
]

```

Will serve PDF files directly from the content folder, whilst allowing normal behaviour for other file types. Tweak the condition accordingly.

---

_[View the full topic](https://forum.getkirby.com/t/url-not-from-media-folder/21486)._
