Answers.Body: <p>It's important to note that your path to resources are relative to your</p>
  
  <pre><code>index.php
  </code></pre>
  
  <p>Whether that's <code>./public/index.php</code> or <code>./index.php</code> where craft is in the same directory level as <code>index.php</code> make sure that's consistent at all three locations.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-08T05:17:52.750Z
Answers.LastActivityDate: 2017-08-08T05:17:52.750Z
Answers.UserDisplayName: NickersF
Answers.Body: <p>There are multiple ways to set the URLs to your files. I don't know if I got your folder structure right. But let's suppose that your web root is set to<br/>
  <code>/var/www/craft-portfolio/public/</code>,</p>
  
  <p>your CSS folder is<br/>
  <code>/var/www/craft-portfolio/public/css/</code></p>
  
  <p>and your Craft folder (actually not relevant) is<br/>
  <code>/var/www/craft-portfolio/craft/</code>.</p>
  
  <p><strong>Root-relative URL</strong></p>
  
  <p>Root-relative URLs start with a <code>/</code> character.</p>
  
  <pre><code>&lt;link rel="stylesheet" href="/css/build.css" /&gt;
  </code></pre>
  
  <p>If you are using multiple environments, the path from the web root to your file has to be the same on each environment.
  Something like this won't work with root-relative URLs:</p>
  
  <pre><code>http://mysite.com/css/build.css
  http://192.168.178.20/projects/mysite/css/build.css
  </code></pre>
  
  <p><strong>Absolute URL</strong></p>
  
  <p>Add the complete URL of the CSS file to the link tag:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="http://mysite.com/css/build.css" /&gt;
  </code></pre>
  
  <p>You can also use Craft's global <a href="http://buildwithcraft.com/docs/templating/global-variables#siteUrl" rel="noreferrer"><code>siteUrl</code></a> variable. To do that define the site's URL (<code>http://mysite.com/</code>) in Settings → General in the Control Panel and add the variable to your tag:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="{{ siteUrl }}css/build.css" /&gt;
  </code></pre>
  
  <p>If you want to use the variable in a multi-environment setup, define it in your <code>general.php</code> file (this overrides the CP settings):</p>
  
  <pre><code>return array(
  
      '192.168.178.20' =&gt; array(
          'siteUrl' =&gt; 'http://192.168.178.20/projects/mysite/',
      ),
  
      'craft.dev' =&gt; array(
          'siteUrl' =&gt; 'http://craft.dev/',
      ),
  
      'mysite.com' =&gt; array(
          'siteUrl' =&gt; 'http://mysite.com/',
      )
  );
  </code></pre>
  
  <p>Just be careful if you want to use this on a multilingual Craft site. If you have multiple locales configured, <code>siteUrl</code> will be set to each locale's site URL, which might point to different folders.
  You can avoid this by setting a <a href="http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables" rel="noreferrer">custom variable</a> (eg. <code>baseUrl</code>) in your <code>general.php</code> file:</p>
  
  <pre><code>'environmentVariables' =&gt; array(
      'baseUrl'  =&gt; 'http://example.dev/',
  )
  </code></pre>
  
  <p>and then use the absolute URL like so:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="{{ craft.config.environmentVariables.baseUrl }}css/build.css" /&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T10:39:41.537Z
Answers.LastActivityDate: 2014-07-26T13:46:21.663Z
Answers.LastEditDate: 2014-07-26T13:46:21.663Z
Answers.UserDisplayName: carlcs
Body: <p>I'm quite new to server config, so this might be a simple mistake. I have a local environment setup on my computer that works just fine. I uploaded my project to my staging server at AWS and the only thing that loads is the index.html in my <code>craft</code> folder. For some reason it gives me a <code>"The requested URL /css/bootstrap.min.css was not found on this server"</code> error for every folder or file I have inside of public folder. </p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  /**
  * General Configuration
  *
  * All of your system's general configuration settings go in here.
  * You can see a list of the default settings in craft/app/etc/config/defaults/general.php
  */
  
  return array(
  );
  </code></pre>
  
  <p>My craft folder in my staging is at: <code>/var/www/craft-portfolio/</code></p>
  
  <p>My Public folder is at: <code>/var/www/craft-portfolio</code></p>
  
  <p>The web root is the public folder that is <code>/var/www/craft-portfolio/public</code></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-26T06:05:33.440Z
Comments.Text: Where is the craft folder located in relation to web root? Can you post your general.php file?
Comments.UserDisplayName: Simon Kuran
Tags: <config><url><multi-environment>
Title: CSS is not loading on staging server
ThreadText: # CSS is not loading on staging server
  
  (Asked by: username_0 on 2014-07-26)
  
  I'm quite new to server config, so this might be a simple mistake. I have a local environment setup on my computer that works just fine. I uploaded my project to my staging server at AWS and the only thing that loads is the index.html in my `craft` folder. For some reason it gives me a `"The requested URL /css/bootstrap.min.css was not found on this server"` error for every folder or file I have inside of public folder.
  
  ```php
  <?php
  
  /**
  * General Configuration
  *
  * All of your system's general configuration settings go in here.
  * You can see a list of the default settings in craft/app/etc/config/defaults/general.php
  */
  
  return array(
  );
  
  ```
  
  My craft folder in my staging is at: `/var/www/craft-portfolio/`
  
  My Public folder is at: `/var/www/craft-portfolio`
  
  The web root is the public folder that is `/var/www/craft-portfolio/public`
  
  **Tags:** config, url, multi-environment
  
  > **Comments:**
  > **username_1**: Where is the craft folder located in relation to web root? Can you post your general.php file?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2014-07-26. Score: 8 | Accepted answer
  
  There are multiple ways to set the URLs to your files. I don't know if I got your folder structure right. But let's suppose that your web root is set to  
  `/var/www/craft-portfolio/public/`,
  
  your CSS folder is  
  `/var/www/craft-portfolio/public/css/`
  
  and your Craft folder (actually not relevant) is  
  `/var/www/craft-portfolio/craft/`.
  
  **Root-relative URL**
  
  Root-relative URLs start with a `/` character.
  
  ```
  <link rel="stylesheet" href="/css/build.css" />
  
  ```
  
  If you are using multiple environments, the path from the web root to your file has to be the same on each environment.
  Something like this won't work with root-relative URLs:
  
  ```
  http://mysite.com/css/build.css
  http://192.168.178.20/projects/mysite/css/build.css
  
  ```
  
  **Absolute URL**
  
  Add the complete URL of the CSS file to the link tag:
  
  ```
  <link rel="stylesheet" href="http://mysite.com/css/build.css" />
  
  ```
  
  You can also use Craft's global [`siteUrl`](http://buildwithcraft.com/docs/templating/global-variables#siteUrl) variable. To do that define the site's URL (`http://mysite.com/`) in Settings → General in the Control Panel and add the variable to your tag:
  
  ```
  <link rel="stylesheet" href="{{ siteUrl }}css/build.css" />
  
  ```
  
  If you want to use the variable in a multi-environment setup, define it in your `general.php` file (this overrides the CP settings):
  
  ```
  return array(
  
      '192.168.178.20' => array(
          'siteUrl' => 'http://192.168.178.20/projects/mysite/',
      ),
  
      'craft.dev' => array(
          'siteUrl' => 'http://craft.dev/',
      ),
  
      'mysite.com' => array(
          'siteUrl' => 'http://mysite.com/',
      )
  );
  
  ```
  
  Just be careful if you want to use this on a multilingual Craft site. If you have multiple locales configured, `siteUrl` will be set to each locale's site URL, which might point to different folders.
  You can avoid this by setting a [custom variable](http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables) (eg. `baseUrl`) in your `general.php` file:
  
  ```
  'environmentVariables' => array(
      'baseUrl'  => 'http://example.dev/',
  )
  
  ```
  
  and then use the absolute URL like so:
  
  ```
  <link rel="stylesheet" href="{{ craft.config.environmentVariables.baseUrl }}css/build.css" />
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2017-08-08. Score: 1
  
  It's important to note that your path to resources are relative to your
  
  ```
  index.php
  
  ```
  
  Whether that's `./public/index.php` or `./index.php` where craft is in the same directory level as `index.php` make sure that's consistent at all three locations.
  
  
  ---
  
  