Solved; htaccess works in localhost but doesn’t work in EC2 instance
After Moving the files from localhost to EC2 Instance. While opening the application If you are getting 500 or internal server error, then we have to check
In AWS EC2 By default EC2 doesn’t have .htaccess enabled, you must edit your httpd.config to allow for it. Here I have mentioned the solution for
The steps are
- Configure
apache mod_rewrite, run in terminal.sudo a2enmod rewrite - Add this code in this file after closing VirtualHost tag /etc/apache2/sites-available/000-default.conf DocumentRoot /var/www
Options FollowSymLinks
AllowOverride All
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all - Restart apache server by command
- sudo service apache2 restart