<p>You have to go to your <strong>Admin Dashboard</strong> &gt; <strong>Settings</strong> &gt; <strong>Sites</strong> &gt; <strong>Your site</strong> and delete <em>Base URL</em> field, then save it and try to navigate.</p>
<p><a href="https://i.sstatic.net/I6jEd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/I6jEd.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2021-02-26T15:26:47.397Z
2021-02-26T15:26:47.397Z
Alexis Dalai Waldo Jiménez
<p>Very new to craft CMS, recently just installed XAMPP with php 7 and craft 3 and followed the <a href="https://craftcms.com/docs/getting-started-tutorial/" rel="nofollow noreferrer">getting started tutorial</a> from Craft CMS. Then when I try to preview or open the page created from the tutorial, it gives me a 404 template not found error.</p>
<p>The error is as follows:</p>
<pre><code>yii\web\NotFoundHttpException: Template not found: $PRIMARY_SITE_URL/$PRIMARY_SITE_URL/blog/this-is-my-blog in C:\xampp\htdocs\craft\vendor\craftcms\cms\src\controllers\TemplatesController.php:92
Stack trace:
#0 [internal function]: craft\controllers\TemplatesController-&gt;actionRender('$PRIMARY_SITE_U...', Array)
#1 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#2 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\Controller.php(181): yii\base\InlineAction-&gt;runWithParams(Array)
#3 C:\xampp\htdocs\craft\vendor\craftcms\cms\src\web\Controller.php(190): yii\base\Controller-&gt;runAction('render', Array)
#4 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\Module.php(534): craft\web\Controller-&gt;runAction('render', Array)
#5 C:\xampp\htdocs\craft\vendor\craftcms\cms\src\web\Application.php(274): yii\base\Module-&gt;runAction('templates/rende...', Array)
#6 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\web\Application.php(104): craft\web\Application-&gt;runAction('templates/rende...', Array)
#7 C:\xampp\htdocs\craft\vendor\craftcms\cms\src\web\Application.php(259): yii\web\Application-&gt;handleRequest(Object(craft\web\Request))
#8 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\Application.php(392): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#9 C:\xampp\htdocs\craft\web\index.php(23): yii\base\Application-&gt;run()
#10 {main}
</code></pre>
<p>and it looks like this:
<a href="https://i.sstatic.net/VO633.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VO633.png" alt="enter image description here" /></a></p>
<p>I have followed all the instructions in the tutorial, and have created the _entry.twig in my templates/blog folder. Any help would be much appreciated</p>

CC BY-SA 4.0
2021-02-25T02:15:34.063Z
Do you have a `PRIMARY_SITE_URL` key in your `.env` file? For example, your .env file might have `PRIMARY_SITE_URL="http://example.test"`
andrewmenich
CC BY-SA 4.0
2021-02-26T02:04:40.313Z
@ajamesm
No, it doesn't seem like I have it in my .env file. How do I add this in if I am running on localhost at the moment? would it just be `PRIMARY_SITE_URL=localhost`?
Steven Zhang
CC BY-SA 4.0
2021-02-26T03:42:35.987Z
OH WAIT, i put PRIMARY_SITE_URL="http://localhost/craft/web/" and it worked! Thank you so much. I couldn't find any documentations on PRIMARY_SITE_URL, where was I supposed to add this key in?
Steven Zhang
<error-templates><404-page>
Template not found: $PRIMARY_SITE_URL/$PRIMARY_SITE_URL/blog/this-is-my-blog
# Template not found: $PRIMARY_SITE_URL/$PRIMARY_SITE_URL/blog/this-is-my-blog

(Asked by: username_0 on 2021-02-25)

Very new to craft CMS, recently just installed XAMPP with php 7 and craft 3 and followed the getting started tutorial from Craft CMS. Then when I try to preview or open the page created from the tutorial, it gives me a 404 template not found error.
The error is as follows:
yii\web\NotFoundHttpException: Template not found: $PRIMARY_SITE_URL/$PRIMARY_SITE_URL/blog/this-is-my-blog in C:\xampp\htdocs\craft\vendor\craftcms\cms\src\controllers\TemplatesController.php:92
Stack trace:
#0 [internal function]: craft\controllers\TemplatesController->actionRender('$PRIMARY_SITE_U...', Array)
#1 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#2 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#3 C:\xampp\htdocs\craft\vendor\craftcms\cms\src\web\Controller.php(190): yii\base\Controller->runAction('render', Array)
#4 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\Module.php(534): craft\web\Controller->runAction('render', Array)
#5 C:\xampp\htdocs\craft\vendor\craftcms\cms\src\web\Application.php(274): yii\base\Module->runAction('templates/rende...', Array)
#6 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\web\Application.php(104): craft\web\Application->runAction('templates/rende...', Array)
#7 C:\xampp\htdocs\craft\vendor\craftcms\cms\src\web\Application.php(259): yii\web\Application->handleRequest(Object(craft\web\Request))
#8 C:\xampp\htdocs\craft\vendor\yiisoft\yii2\base\Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#9 C:\xampp\htdocs\craft\web\index.php(23): yii\base\Application->run()
#10 {main}

and it looks like this:

I have followed all the instructions in the tutorial, and have created the _entry.twig in my templates/blog folder. Any help would be much appreciated

**Tags:** error-templates, 404-page
> **Comments:**
> **username_1**: Do you have a `PRIMARY_SITE_URL` key in your `.env` file? For example, your .env file might have `PRIMARY_SITE_URL="http://example.test"`  
> **username_0**: @ajamesm No, it doesn't seem like I have it in my .env file. How do I add this in if I am running on localhost at the moment? would it just be `PRIMARY_SITE_URL=localhost`?  
> **username_0**: OH WAIT, i put PRIMARY_SITE_URL="http://localhost/craft/web/" and it worked! Thank you so much. I couldn't find any documentations on PRIMARY_SITE_URL, where was I supposed to add this key in?  

---

## 1 answers

### Answer by username_2 on 2021-02-26. Score: 2

You have to go to your **Admin Dashboard** > **Settings** > **Sites** > **Your site** and delete *Base URL* field, then save it and try to navigate.

[![enter image description here](https://i.sstatic.net/I6jEd.png)](https://i.sstatic.net/I6jEd.png)


---

