My htaccess file works on localhost but doesn't work when i deploy it to EC2 instance.
I'm using Macbook and in finder i cannot see the htaccess file, i thought that perhaps it didn't get copied to EC2 instance but i don't think this is the problem because when i copy the project i can see the htaccess file in my editor.
Is there something enabling mod rewrite in EC2 linux instance? If there is, i didn't do it or it enables mod rewrite as default?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
I pieced together some info from various posts so I thought I'd put up an answer.
/etc/httpd/conf/httpd.conf
sudo vim /etc/httpd/conf/httpd.conf
(How to edit httpd.conf file in AMAZON EC2)DocumentRoot "/var/www/html"
was listed in two places for me. I had to change the subsequent AllowOverride None
to AllowOverride All
in those two places.I was trying to make the same changes in a .htaccess file (removing the index.php from urls in a code igniter application). Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With