Subrata Sarkar
Subrata Sarkar

Reputation: 3064

Permalinks give 404 error in WordPress on AWS EC2 instance running Ubuntu 16.04

I have created an AWS (Ubuntu 16.04) AMI. Installed WordPress and uploaded my Custom theme. Both operations went fine.

I put my site inside /var/www/html.

This is a fresh installation. I created two two pages /login and /forbidden. In Permalinks page I have selected Post Name option.

The site has .htaccess file in place (root) with the following content:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

But whenever I am trying to access http://ec2-54-174-120-1.compute-1.amazonaws.com/login I get 404 error.

Configuration in: /etc/apache2/apache2.conf

<Directory /var/www/html>
   Options Indexes FollowSymLinks
   AllowOverride All
   Require all granted
</Directory>

DocumentRoot /var/www/html is set in both /etc/apache2/sites-availabe/000-default.conf and /etc/apache2/sites-enabled/000-default.conf

I restarted Apache server several times with no luck.

sudo service apache2 restart

Upvotes: 5

Views: 2201

Answers (1)

Roy Saldanha
Roy Saldanha

Reputation: 189

I think you need to enable Apache mod_rewrite module. You can do it by running the following command:

sudo a2enmod rewrite

Upvotes: 8

Related Questions