PHPackages                             transom/craft-site-asset-router - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. transom/craft-site-asset-router

ActiveCraft-plugin[File &amp; Storage](/categories/file-storage)

transom/craft-site-asset-router
===============================

Routes asset uploads to site-specific subfolders in Craft CMS multisite installations

1.2.0(3d ago)00MITPHPPHP ^8.2

Since Jun 24Pushed todayCompare

[ Source](https://github.com/transomdesign/craft-site-asset-router)[ Packagist](https://packagist.org/packages/transom/craft-site-asset-router)[ RSS](/packages/transom-craft-site-asset-router/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

Site Asset Router
=================

[](#site-asset-router)

A Craft CMS 5 plugin for multi-site installations that organizes assets into site-specific subfolders and scopes the CP asset browser to the active site.

What it does
------------

[](#what-it-does)

In a multisite Craft installation where all sites share the same asset volumes, uploads from different sites end up mixed together. Site Asset Router solves this by:

1. **Upload routing:** New uploads are placed in `{siteHandle}/{volumeHandle}/` subfolders within each volume.
2. **Asset browser filtering:** The CP asset browser shows only the active site's assets per volume, so editors never see another site's files.

### Folder structure

[](#folder-structure)

Given three sites (`brandA`, `brandB`, `brandC`) and a volume called `images`, uploads are organized as:

```
images/                        (volume root on filesystem)
  brandA/images/               uploads from Brand A
  brandB/images/               uploads from Brand B
  brandC/images/               uploads from Brand C

```

Subfolders are created on first upload. No manual setup required.

Requirements
------------

[](#requirements)

- Craft CMS 5.0+
- PHP 8.2+

Installation
------------

[](#installation)

```
composer require transomdesign/craft-site-asset-router
```

> If you're running DDEV, prefix with `ddev exec`.

Then install the plugin:

```
php craft plugin/install site-asset-router
```

The plugin appears as "Site Asset Router" in the Craft CP under Settings &gt; Plugins.

Asset field setup (required)
----------------------------

[](#asset-field-setup-required)

For every **Asset field** that uploads into a routed volume, set these two options in the field's settings (Settings → Fields → your field):

Field settingValue**Restrict assets to a single location****On** — pointed at the volume**Allow subfolders****On**That's it. The plugin then files uploads under `{siteHandle}/{volumeHandle}/` and keeps them there on every save.

> ⚠️ **Never use "Restrict location: On" + "Allow subfolders: Off"** on a routed volume. Craft moves every related asset to the volume root on each entry save, which fights the plugin and scatters files. (The plugin will fight back and re-anchor them, but only at the cost of a move on every save — so just turn subfolders on.)

**Don't want to restrict the field to one volume?** Then leave **"Restrict assets to a single location" Off** — the plugin still routes uploads to the correct `{site}/{volume}/` folder. Either of these is fine; the broken combo above is the only one to avoid.

Configuration
-------------

[](#configuration)

Create or edit `config/site-asset-router.php`:

```
