<p>I forgot to add <code>define('CRAFT_SITE', 'sub');</code> to the <code>index.php</code> file on my Site 2 web root.</p>

CC BY-SA 4.0
2018-11-11T00:45:18.797Z
2018-11-11T00:45:18.797Z
kmgdev
<p>I've set up a Resources section on a multi-site installation with the type of Channel. For Site 1 I've set the routing rule to be <code>{resourcesParent.one.slug}/{slug}</code> and for Site 2 I've set the rule as <code>{slug}</code>.</p>

<p><a href="https://i.sstatic.net/cHZlO.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cHZlO.jpg" alt="enter image description here"></a></p>

<p>So for Site 1 a resource titled <code>sample-resource</code> would resolve to <code>www.example.com/parent-slug/sample-resource</code>.</p>

<p>And for Site 2 it would resolve as <code>sub.example.com/sample-resource</code></p>

<p>Everything works fine for Site 1, however when I go to <code>sub.example.com/sample-resource</code> I get a "template not found: sample-resource" 404 error.</p>

<p>Seems like this should work so I'm not sure what I'm doing wrong.</p>

<p>EDIT: I just noticed that <code>sub.example.com/parent-slug/sample-resource</code> is resolving, so I think something's wrong with my config. Here's what I have for my dev environment in <code>craft/config/general.php</code>:</p>

<pre><code>'dev' =&gt; [
    'siteUrl' =&gt; array(
        '//www.example.com',
        '//sub.example.com'
    ),
</code></pre>

<routing><multi-site>
Second Site Channel URL Route Not Working
# Second Site Channel URL Route Not Working

(Asked by: username_0 on 2018-11-11)

I've set up a Resources section on a multi-site installation with the type of Channel. For Site 1 I've set the routing rule to be {resourcesParent.one.slug}/{slug} and for Site 2 I've set the rule as {slug}.

So for Site 1 a resource titled sample-resource would resolve to www.example.com/parent-slug/sample-resource.
And for Site 2 it would resolve as sub.example.com/sample-resource
Everything works fine for Site 1, however when I go to sub.example.com/sample-resource I get a "template not found: sample-resource" 404 error.
Seems like this should work so I'm not sure what I'm doing wrong.
EDIT: I just noticed that sub.example.com/parent-slug/sample-resource is resolving, so I think something's wrong with my config. Here's what I have for my dev environment in craft/config/general.php:
'dev' => [
    'siteUrl' => array(
        '//www.example.com',
        '//sub.example.com'
    ),

**Tags:** routing, multi-site

---

## 1 answers

### Answer by username_0 on 2018-11-11. Score: 1 | Accepted answer

I forgot to add `define('CRAFT_SITE', 'sub');` to the `index.php` file on my Site 2 web root.


---

