title: Permalinks give 404 error in WordPress on AWS EC2 instance running Ubuntu 16.04
body: <p>I have created an AWS (Ubuntu 16.04) AMI. Installed WordPress and uploaded my Custom theme. Both operations went fine.</p>
  
  <p>I put my site inside <code>/var/www/html</code>.</p>
  
  <p>This is a fresh installation. I created two two pages <code>/login</code> and <code>/forbidden</code>. In Permalinks page I have selected <strong>Post Name</strong> option.</p>
  
  <p>The site has <code>.htaccess</code> file in place (root) with the following content:</p>
  
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  
  # END WordPress
  </code></pre>
  
  <p>But whenever I am trying to access <code>http://ec2-54-174-120-1.compute-1.amazonaws.com/login</code> I get 404 error.</p>
  
  <p>Configuration in: <code>/etc/apache2/apache2.conf</code></p>
  
  <pre><code>&lt;Directory /var/www/html&gt;
     Options Indexes FollowSymLinks
     AllowOverride All
     Require all granted
  &lt;/Directory&gt;
  </code></pre>
  
  <p><code>DocumentRoot /var/www/html</code> is set in both <code>/etc/apache2/sites-availabe/000-default.conf</code> and <code>/etc/apache2/sites-enabled/000-default.conf</code></p>
  
  <p>I restarted Apache server several times with no luck.</p>
  
  <p><code>sudo service apache2 restart</code></p>