How to enable .htaccess on Amazon AWS EC2 Instance

Here are the steps.

1) Login to your EC2 instance with SSH.

ssh -i “Yourkey.pem” ubuntu@yourpublicip

2) Enable Mode Rewrite, this is just incase if it’s not enabled.

sudo a2enmod rewrite

3) Go to following directory.

cd /etc/apache2/sites-enabled

If you use LS command here you will see following file.


That’s the file with default apache configuration which are applied to your sites in /var/www/html folder.

4) Open this file for editing.

sudo nano 000-default.conf

5) Add following lines after DocumentRoot /var/www/html line.

<Directory />
Options FollowSymLinks
AllowOverride All
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

6) Save the file and restart the apache.

sudo service apache2 restart

that’s it and now your .htaccess file will work and your application will start working.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

Comments are closed.