Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only the home route working on my EC2 instance server for AWS for Laravel 4

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) )

like image 415
user1072337 Avatar asked Mar 18 '14 23:03

user1072337


2 Answers

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 :)

like image 144
Y M Avatar answered Oct 01 '22 15:10

Y M


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.

like image 42
user1072337 Avatar answered Oct 01 '22 13:10

user1072337