I am trying to set up my laravel project on my EC2 Instance for AWS. I have successfully uploaded the files to the server using SFTP, and I rewrote the 000-default.conf file to point to the public folder of the project.
The home route is loading fine, but none of the other routes are working? Any idea what is going on here? They all work fine on local host (MAMP) and on other servers.
All of the other routes show a NOT FOUND page (The requested URL /fans was not found on this server (for instance) )
This worked for me:
First in 000-default.conf
Make Document Root point to your public folder:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/your/laravel-project-folder/public/
Then add this to end of the 000-default.conf:
<Directory "/var/www/html/your/laravel-project-folder/">
AllowOverride All
</Directory>
Last two steps:
run this as root user:
1. sudo a2enmod rewrite
2. service apache2 restart
Now everything was working fine for me.
Hope this helps :)
For people who have this issue in the future:
All I had to do was add:
<Directory /var/www>
AllowOverride All
</Directory>
to my 000-default.conf
file in /etc/apache2/sites-available
directory.
Place it right under the DocumentRoot line.
Cheers.
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