title: Unable to access images and CSS file in CakePHP
body: <p>I am using my old website design code in a new app. The problem is I didn't use the HTML helper for loading images. I am using the HTML image tag <code>&lt;img style="width:95px; margin-top:20px;"src="images/logo.png" /&gt;</code>. It works fine in this link <a href="http://localhost/dashboard/dboard/" rel="nofollow noreferrer">http://localhost/dashboard/dboard/</a> but doesn't work in this link <a href="http://localhost/dashboard/dboard/pages/demo" rel="nofollow noreferrer">http://localhost/dashboard/dboard/pages/demo</a>. Pages is a controller and demo is a method in the controller. </p>
  
  <p>My <code>PagesController</code> look like this:-</p>
  
  <pre><code>namespace App\Controller;
  
  use Cake\Core\Configure;
  use Cake\Network\Exception\NotFoundException;
  use Cake\View\Exception\MissingTemplateException;
  class PagesController extends AppController
  {
  
  
      public function display()
      {
          $path = func_get_args();
      enter code here`enter code here`
          $count = count($path);
          if (!$count) {
              return $this-&gt;redirect('/');
          }
          $page = $subpage = null;
  
          if (!empty($path[0])) {
              $page = $path[0];
          }
          if (!empty($path[1])) {
              $subpage = $path[1];
          }
          $this-&gt;set(compact('page', 'subpage'));
  
          try {
              $this-&gt;render(implode('/', $path));
          } catch (MissingTemplateException $e) {
              if (Configure::read('debug')) {
                  throw $e;
              }
              throw new NotFoundException();
          }
      }
  
  
       public function demo()
      {
  
      }
      public function contactus()
      {
  
      }
      public function downloads()
      {
  
      }
  }
  </code></pre>
  
  <p>And my .htaccess file look like this:-</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>The important thing is I have placed all my images here: C:\xampp\htdocs\dashboard\dboard\webroot. I am using CakePHP 3.0.</p>
  
  <p>The output looks like this:-</p>
  
  <p><a href="https://i.stack.imgur.com/6aa1t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6aa1t.png" alt="with working css and images "></a>
  <a href="https://i.stack.imgur.com/GPWZq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GPWZq.png" alt="without working css and images"></a></p>