title: .htaccess not working on my Ubuntu 14.04 Distribution
body: <p>I have just configured my LAMP stack on my Ubuntu 14.04 distribution and want to set <code>.htaccess</code> up to serve a website.</p>
  
  <p>I followed the tutorial <a href="https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file" rel="nofollow">https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file</a> and configured a virtual host for my domain, however I am still unable to use the .htaccess file in my projects root, whenever I try to serve a page I get a <code>404 error</code>.</p>
  
  <p>The <code>.conf</code> file for my domain looks like:</p>
  
  <pre><code> &lt;VirtualHost *:80&gt;
   ServerAdmin alexmk92@live.co.uk
   ServerName alexsims.me
   ServerAlias www.alexsims.me
   DocumentRoot /var/www/alexsims.me
  
   &lt;Directory /&gt;
      Options FollowSymLinks
      AllowOverride None
   &lt;/Directory&gt;
  
   &lt;Directory /var/www/alexsims.me&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow,deny
      allow from all
   &lt;/Directory&gt;
  
  
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
   &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I tried to change <code>AllowOverride None</code> to <code>AllowOverride All</code> but that caused an internal 500 error even after enabling <code>mod_rewrite</code>.</p>
  
  <p>Regards,
  Alex.</p>
  
  <p>EDIT:  <code>.htaccess</code> contents</p>
  
  <pre><code>#Force www:
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^alexsims.me [NC]
  RewriteRule ^(.*)$ http://www.alexsims.me/$1 [L,R=301,NC]
  
  #--- Rewrite PHP files clean URL
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteRule ^([A-Za-z0-9-]+)$ ?page=$1 [NC,L]
  RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ ?page=$1&amp;id=$2 [NC,L]
  </code></pre>