<p>I managed to figure this out: in my .env file I had still defined <code>'siteUrl' =&gt; getenv('DEFAULT_SITE_URL'),</code>
Apparently having that alias named 'siteURL' locked the Base URL to keep defaulting to @web/. Deleting the alias resolved the issue.</p>

CC BY-SA 4.0
2022-03-11T15:06:19.457Z
2022-03-11T15:06:19.457Z
Jolle
<p>Does this work?</p>
<p>general.php</p>
<pre><code> 'aliases' =&gt; [
      '@defaultSiteUrl' =&gt; getenv('DEFAULT_SITE_URL'),
  ];

</code></pre>
<p>And in <strong>CP &gt; Settings &gt; Site</strong> set your Base url to:
<code>@defaultSiteUrl</code></p>
<ol>
<li>iirc using <code>@web</code> as your base url is not supported anymore</li>
<li>The value of <code>DEFAULT_SITE_URL</code> in your .env is set to an url right? something like <code>http://domain.test</code>?</li>
</ol>

CC BY-SA 4.0
2022-03-11T09:41:17.243Z
Thanks for the help! Unfortunately your suggestion does the same as what I've tried earlier: whether I use and environment variable, an alias or a literal URL in the Base URL field, when I save the settings and return to the page, Craft has reverted the field's value back to '@web/' again. It seems as though there is some override in a config file or something, but I don't know where that would be.
Jolle
CC BY-SA 4.0
2022-03-11T08:59:03.867Z
2022-03-11T09:07:44.153Z
2022-03-11T09:07:44.153Z
Nicholas
<p>In the CP &gt; Settings &gt; Sites, setting the Base URL keeps defaulting to <code>@web/</code></p>
<p>I have an environment variable <code>$DEFAULT_SITE_URL</code> set up in my [.env] file, and this is recognized (auto-fill suggests it and I can select it) by the CP, but when I save the settings and return to the page, the Base URL has reverted to <code>@web/</code>.</p>
<p>I've tried removing the @web alias I have in my .env file  <code>'@web' =&gt; getenv('DEFAULT_SITE_URL'),</code> but this only results in the CP warning <em>The @web alias is not recommended if it is determined automatically.</em></p>
<p>It seems I may have some hard-set setting somewhere, but I would not know where.
An <a href="https://github.com/craftcms/cms/issues/3559#issuecomment-465297478" rel="nofollow noreferrer">old post from Brandon</a> suggests checking the [config/project.yaml] file but I'm not finding any reference to the Base URL there or <code>$DEFAULT_SITE_URL</code>.</p>
<p>Does anyone have any idea?</p>

<craft3>
Base URL in CP keeps defaulting to @web/
# Base URL in CP keeps defaulting to @web/

(Asked by: username_0 on 2022-03-10)

In the CP > Settings > Sites, setting the Base URL keeps defaulting to `@web/`

I have an environment variable `$DEFAULT_SITE_URL` set up in my [.env] file, and this is recognized (auto-fill suggests it and I can select it) by the CP, but when I save the settings and return to the page, the Base URL has reverted to `@web/`.

I've tried removing the @web alias I have in my .env file `'@web' => getenv('DEFAULT_SITE_URL'),` but this only results in the CP warning *The @web alias is not recommended if it is determined automatically.*

It seems I may have some hard-set setting somewhere, but I would not know where.
An [old post from Brandon](https://github.com/craftcms/cms/issues/3559#issuecomment-465297478) suggests checking the [config/project.yaml] file but I'm not finding any reference to the Base URL there or `$DEFAULT_SITE_URL`.

Does anyone have any idea?

**Tags:** craft3

---

## 2 answers

### Answer by username_0 on 2022-03-11. Score: 2 | Accepted answer

I managed to figure this out: in my .env file I had still defined `'siteUrl' => getenv('DEFAULT_SITE_URL'),`
Apparently having that alias named 'siteURL' locked the Base URL to keep defaulting to @web/. Deleting the alias resolved the issue.


---

### Answer by username_1 on 2022-03-11. Score: 2

Does this work?
general.php
 'aliases' => [
      '@defaultSiteUrl' => getenv('DEFAULT_SITE_URL'),
  ];


And in CP > Settings > Site set your Base url to:
@defaultSiteUrl

iirc using @web as your base url is not supported anymore
The value of DEFAULT_SITE_URL in your .env is set to an url right? something like http://domain.test?

> **Comments:**
> **username_0**: Thanks for the help! Unfortunately your suggestion does the same as what I've tried earlier: whether I use and environment variable, an alias or a literal URL in the Base URL field, when I save the settings and return to the page, Craft has reverted the field's value back to '@web/' again. It seems as though there is some override in a config file or something, but I don't know where that would be.  

---

