<pre><code>HTTP 404 – Not Found – yii\web\NotFoundHttpException
Template not found: $DEFAULT_SITE_URL
1. in /Users/brenbauer/morphd/craft3/vendor/craftcms/cms/src/controllers/TemplatesController.php at line 90
81828384858687888990919293949596979899    {
        // Does that template exist?
        if (
            (
                Craft::$app-&gt;getConfig()-&gt;getGeneral()-&gt;headlessMode &amp;&amp;
                Craft::$app-&gt;getRequest()-&gt;getIsSiteRequest()
            ) ||
            !$this-&gt;getView()-&gt;doesTemplateExist($template)
        ) {
            throw new NotFoundHttpException('Template not found: ' . $template);
        }
 
        // Merge any additional route params
        $routeParams = Craft::$app-&gt;getUrlManager()-&gt;getRouteParams();
        unset($routeParams['template'], $routeParams['template']);
        $variables = array_merge($variables, $routeParams);
 
        return $this-&gt;renderTemplate($template, $variables);
    }
2. craft\controllers\TemplatesController::actionRender('$DEFAULT_SITE_URL', [])
</code></pre>

CC BY-SA 4.0
2020-06-25T21:27:56.657Z
How do you have the `$DEFAULT_SITE_URL` environment variable defined and setup in Craft?
Brad Bell
CC BY-SA 4.0
2020-06-28T16:38:51.080Z
I was able to get this resolved; thank you, Brad.
Bren Bauer
CC BY-SA 4.0
2020-09-25T10:15:37.200Z
Can you upload the answer and mark it as solved @BrenBauer?
darylknight
<404>
I set up a local environment. I can log in, but if I select the site icon or preview I get a 404 message
# I set up a local environment. I can log in, but if I select the site icon or preview I get a 404 message

(Asked by: username_0 on 2020-06-25)

HTTP 404 – Not Found – yii\web\NotFoundHttpException
Template not found: $DEFAULT_SITE_URL
1. in /Users/brenbauer/morphd/craft3/vendor/craftcms/cms/src/controllers/TemplatesController.php at line 90
81828384858687888990919293949596979899    {
        // Does that template exist?
        if (
            (
                Craft::$app->getConfig()->getGeneral()->headlessMode &&
                Craft::$app->getRequest()->getIsSiteRequest()
            ) ||
            !$this->getView()->doesTemplateExist($template)
        ) {
            throw new NotFoundHttpException('Template not found: ' . $template);
        }
 
        // Merge any additional route params
        $routeParams = Craft::$app->getUrlManager()->getRouteParams();
        unset($routeParams['template'], $routeParams['template']);
        $variables = array_merge($variables, $routeParams);
 
        return $this->renderTemplate($template, $variables);
    }
2. craft\controllers\TemplatesController::actionRender('$DEFAULT_SITE_URL', [])

**Tags:** 404

> **Comments:**
> **username_1**: How do you have the `$DEFAULT_SITE_URL` environment variable defined and setup in Craft?  
> **username_0**: I was able to get this resolved; thank you, Brad.  
> **username_2**: Can you upload the answer and mark it as solved @BrenBauer?  

---

## 0 answers

