Answers.Body: <p>When you take a look into Craft you'll see this</p>
  
  <pre><code> /**
   * @var string|string[] The base URL to the site(s). If set, it will take precedence over the Base URL settings in Settings → Sites → [Site Name].
   *
   * This can be set to a string, which will override the primary site’s base URL only, or an array with site handles used as the keys.
   *
   * The URL(s) must begin with either `http://`, `https://`, or `//` (protocol-relative).
   */
  public $siteUrl
  </code></pre>
  
  <p>So the <code>baseUrl</code> is what you insert in your site settings, the <code>siteUrl</code> can overwrite these values from your config</p>
  
  <p>The <code>Site.php</code> (model) has a this function as well</p>
  
  <pre><code>/**
   * Overrides the base URL while keeping track of the original one.
   *
   * @param string $baseUrl
   *
   * @return void
   */
  public function overrideBaseUrl(string $baseUrl)
  {
      $this-&gt;originalBaseUrl = (string)$this-&gt;baseUrl;
      $this-&gt;baseUrl = rtrim($baseUrl, '/').'/';
  }
  </code></pre>
  
  <p>which is called in the Site service</p>
  
  <pre><code>$site-&gt;overrideBaseUrl($generalConfig-&gt;siteUrl);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-07T14:29:18.957Z
Answers.LastActivityDate: 2018-03-07T14:29:18.957Z
Answers.UserDisplayName: Robin Schambach
Body: <p>What is the difference between <code>siteUrl</code> and <code>baseUrl</code> in Craft 3? Is there any? </p>
  
Tags: <craft3><siteurl>
Title: What is the difference between siteUrl and baseUrl?
ThreadText: # What is the difference between siteUrl and baseUrl?
  
  (Asked by: username_0 on 2018-03-07)
  
  What is the difference between `siteUrl` and `baseUrl` in Craft 3? Is there any?
  
  **Tags:** craft3, siteurl
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-07. Score: 1 | Accepted answer
  
  When you take a look into Craft you'll see this
  
  ```
   /**
   * @var string|string[] The base URL to the site(s). If set, it will take precedence over the Base URL settings in Settings → Sites → [Site Name].
   *
   * This can be set to a string, which will override the primary site’s base URL only, or an array with site handles used as the keys.
   *
   * The URL(s) must begin with either `http://`, `https://`, or `//` (protocol-relative).
   */
  public $siteUrl
  
  ```
  
  So the `baseUrl` is what you insert in your site settings, the `siteUrl` can overwrite these values from your config
  
  The `Site.php` (model) has a this function as well
  
  ```
  /**
   * Overrides the base URL while keeping track of the original one.
   *
   * @param string $baseUrl
   *
   * @return void
   */
  public function overrideBaseUrl(string $baseUrl)
  {
      $this->originalBaseUrl = (string)$this->baseUrl;
      $this->baseUrl = rtrim($baseUrl, '/').'/';
  }
  
  ```
  
  which is called in the Site service
  
  ```
  $site->overrideBaseUrl($generalConfig->siteUrl);
  
  ```
  
  
  ---
  
  