title: Sequence re .HTACCESS file
body: <p>I'm trying to generate a simple .htacces file for a website. At the moment there are only 3 commands and this is the order they appear in the file:</p>
  
  <pre><code># KEEP ALIVE #
  # OPTIMIZE WEBSITE #
  # 404 #
  </code></pre>
  
  <p>When I add a fourth element - </p>
  
  <pre><code># EXPIRES CACHING #:
  # KEEP ALIVE #
  # OPTIMIZE WEBSITE #
  # EXPIRES CACHING #
  # 404 #
  </code></pre>
  
  <p>The 404 command fails. </p>
  
  <p>Is there a correct sequence that these instructions should follow in order for them to work? </p>
  
  <pre><code>## KEEP ALIVE ##
  &lt;ifModule mod_headers.c&gt; 
  Header set Connection keep-alive 
  &lt;/ifModule&gt;
  ## KEEP ALIVE ##  
  
  ## OPTIMIZE WEBSITE ##
  &lt;IfModule mod_deflate.c&gt; 
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css             application/x-javascript 
  BrowserMatch ^Mozilla/4 gzip-only-text/html 
  BrowserMatch ^Mozilla/4\.0[678] no-gzip 
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
  &lt;/IfModule&gt;
  ## OPTIMIZE WEBSITE ## 
  
  ## EXPIRES CACHING ##
  &lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/html "access plus 1 month"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType text/x-javascript "access plus 1 month"
  ExpiresByType application/x-shockwaveflash "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresDefault "access plus 1 month"
  &lt;/IfModule&gt;
  ## EXPIRES CACHING ##
  
  ## 404 ##
  ErrorDocument 404 /404.html
  ## 404 ##
  </code></pre>