Last Updated: February 25, 2016
· dustinrjo

Amazon EC2 Wordpress Pretty Permalinks on LAMP

If you install your own Wordpress out of the box on Amazon Web Services from a bare Amazon Linux instance and you want to enable pretty permalinks, you'll find that the basic LAMP install

sudo yum groupinstall -y "Web Server" "MySQL Database" "PHP Support"

does have Apache's mod_rewrite enabled but does not work with these de facto .htaccess rules

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

So you need to go into httpd.conf

sudo vi /etc/httpd/conf/httpd.conf

and set AllowOverride to All instead of None

<Directory "/var/www/html">

# You'll see a big comment block here between the directory tag
# Possible values for the Options directive are "None", "All",

    AllowOverride All

# Controls who can get stuff from this server.
    Order allow,deny
    Allow from all


Then to see if it works you have to restart the http services.

sudo service httpd restart

With this configured, the correct permissions for the .htaccess file and pretty permalinks enabled in the wp-admin settings, you should be good to go.

1 Response
Add your response


Thanks a lot! It finally saved my day! I can't believe this info. is no where on the wordpress site at all!

over 1 year ago ·