Permalink Issue scenario for wordpress site in EC2 AWS Server

  1.  .htaccess
  2.  mod_rewrite

The .htaccess is a distributed configuration file, and is how Apache handles configuration changes on a per-directory basis.

WordPress uses this file to manipulate how Apache serves files from its root directory, and subdirectories thereof. Most notably, WP modifies this file to be able to handle pretty permalinks.

 .htaccess file is working properly with correct permissions. You can simply make sure the file exists and set permissions to 777, test, then set your permissions back as they were to make your file secure once again.Check your website , if its working that all  well if not then its a mod_rewrite .

mod_rewrite check in  the below following procedure:

  1. make a info.php file with only this for content: “<?php phpinfo(); ?>” and save it as info.php. Upload to your root directory and go to your domain name/info.php and search for the text “mod_rewrite” if you find it in the php info file, then your mod_rewrite is enabled. If not, then enable it.
  2. To enable mod_rewrite, try the command line command:
    sudo a2enmod rewrite

If mod_rewite was enabled then something else is wrong. Check your etc/httpd/conf/httpd.conf file. It should have the following in it:

AllowOverride All

Basically, you’ll be adding All insted of None to AllowOverride, you do not want to edit the main directory configuration, you want to edit the one that looks like this:

<Directory "/var/www/html">

Not:

<Directory />

Then restart Apache with:

sudo service httpd restart

from the command line.

Now, if you are using WordPress and trying to enable Permalinks as I was, next, go to your wp-admin page and go to settings/permalinks and change from default to post-name and click the save button to save the changes and try again. If you did this before making mod_rewrite fixes, you may need to change back to default, save, and then change to post-name again and save one last time for the settings to work.