Answers.Body: <p>You need to set it without an <code>@</code></p>
  
  <pre class="lang-PHP prettyprint-override"><code>'*' =&gt; [
      'aliases' =&gt; [
          'myNewAlias' =&gt; getenv('SITE_URL_DE')
       ]
  ]
  </code></pre>
  
  <p>Then you can do</p>
  
  <pre class="lang-TWIG prettyprint-override"><code>{{ alias('@myNewAlias') }}
  </code></pre>
  
  <p>or in PHP</p>
  
  <pre class="lang-PHP prettyprint-override"><code>Craft::getAlias('@myNewAlias');
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-05T08:34:11.347Z
Answers.LastActivityDate: 2019-03-05T08:34:11.347Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I'm not sure if I understand the alias concept entirely</p>
  
  <p>So I want to create an alias.</p>
  
  <p>I write a variable into my <code>.env</code> File: </p>
  
  <pre><code>SITE_URL_DE="http://hello.local"
  </code></pre>
  
  <p>Then I put it into my <code>general.php</code> File:</p>
  
  <pre><code>'*' =&gt; [
      //other settings as well here
      'aliases' =&gt; [
        '@myNewAlias' =&gt; getenv('SITE_URL_DE'),
      ],
    ],
  </code></pre>
  
  <p>Now I want to print it in my template:</p>
  
  <pre><code>{{ alias('@myNewAlias') }}
  </code></pre>
  
  <p>This results in: </p>
  
  <blockquote>
    <p>Invalid path alias: @myNewAlias</p>
  </blockquote>
  
  <p>But why?</p>
  
Tags: <config><siteurl><alias>
Title: Invalid path alias
ThreadText: # Invalid path alias
  
  (Asked by: username_0 on 2019-03-05)
  
  I'm not sure if I understand the alias concept entirely
  
  So I want to create an alias.
  
  I write a variable into my `.env` File:
  
  ```
  SITE_URL_DE="http://hello.local"
  
  ```
  
  Then I put it into my `general.php` File:
  
  ```
  '*' => [
      //other settings as well here
      'aliases' => [
        '@myNewAlias' => getenv('SITE_URL_DE'),
      ],
    ],
  
  ```
  
  Now I want to print it in my template:
  
  ```
  {{ alias('@myNewAlias') }}
  
  ```
  
  This results in:
  
  > Invalid path alias: @myNewAlias
  
  But why?
  
  **Tags:** config, siteurl, alias
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-03-05. Score: 2 | Accepted answer
  
  You need to set it without an `@`
  
  ```PHP
  '*' => [
      'aliases' => [
          'myNewAlias' => getenv('SITE_URL_DE')
       ]
  ]
  
  ```
  
  Then you can do
  
  ```TWIG
  {{ alias('@myNewAlias') }}
  
  ```
  
  or in PHP
  
  ```PHP
  Craft::getAlias('@myNewAlias');
  
  ```
  
  
  ---
  
  