title: ErrorDocument 404 not working with routing
body: <p>I tried using this code on <code>.htacces</code> to have my own custom 404 on my page,.</p>
  
  <p><code>ErrorDocument 404 http://mysite.com/404.shtml</code></p>
  
  <p>when i visit the page that does not exist on the site. it must show something like this</p>
  
  <p><img src="https://i.stack.imgur.com/m6Gv4.png" alt="enter image description here"></p>
  
  <p>but this is the one it shows</p>
  
  <p><img src="https://i.stack.imgur.com/iGaDf.png" alt="enter image description here"></p>
  
  <p>here is my complete htaccess</p>
  
  <pre><code>&lt;files .htaccess&gt;
      order allow,deny
      deny from all
  &lt;/files&gt;
  php_value memory_limit 170M
  
  RewriteEngine on
  
  
  Options +FollowSymlinks
  Options -Indexes
  
  
  
  RewriteCond %{REQUEST_URI} (.+)$  [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  AddDefaultCharset utf-8
  RewriteRule (.*) index.php
  
  RewriteEngine on 
  RewriteCond %{HTTP_HOST} ^www.mysite.com.*$ [NC]
  RewriteRule ^(.*)$ http://mysite.com%{REQUEST_URI} [L,R=301]  
  
  ErrorDocument 404 http://mysite.com/404.shtml
  </code></pre>
  
  <p>The location of my <code>htaccess</code> is located along with the <code>404.shtml</code> and the <code>index.php</code> of the site</p>
  
  <p>Removing this code would fix the problem. How can i make it work with routing.</p>
  
  <pre><code>   RewriteCond %{REQUEST_URI} (.+)$  [NC]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      AddDefaultCharset utf-8
      RewriteRule (.*) index.php
  </code></pre>