I just made a new instance on AWS EC2. I have an existing laravel project, pushed it on github and installed it on my new instance. Also installed composer, php, mysql, apache. And when I hit the public
url, laravel redirects me to public/auth/login
. On my localhost everything is fine, but here it givesme an error 404 - Not Found The requested URL /auth/login was not found on this server.
. I have installed before my laravel projects in AWS but never experienced such an error. What could have gone wrong?
Asked
Active
Viewed 5,694 times
2

Alex
- 485
- 6
- 18
-
1So you mean your url is `http://yourdomain.com/public`? If that's the case, you need to change the HTTP server's Document Root to point to the `public` directory of your application. Your URL paths should not contain `public` within them. – Bogdan Mar 08 '16 at 22:40
-
I pointed it right in the public directory and still gives me an error. – Alex Mar 09 '16 at 07:13
3 Answers
4
Everything was from the .htaccess
file. I added AllowOverride All
and everything is ok now!

Alex
- 485
- 6
- 18
-
Instead of modifying the .htaccess file on the public folder, you can just update your virtual host configuration file (e.g. /etc/apache2/site-available/00-default.conf) – Praditha Jul 18 '18 at 08:35
-
1I'm having this exact same problem. How does your .htaccess file look? Where did you add AllowOverride All? – Kevin Glick May 08 '20 at 20:13
2
If you are using apache server then do the following
- Go to your apache2.conf file,
For example in ubuntu the path is
/etc/apache2/apache2.conf
- Paste the following code by making suitable modifiction
<Directory /var/www/the_root_of_your_laravel_project_where_index.php_exists/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Khurshid A Bhuyan
- 349
- 3
- 7
1
Assuming you are using default Amazon Linux, you can edit /etc/httpd/conf/httpd.conf
and set DocumentRoot "<your path to your app>/public"
then restart Apache with sudo service httpd restart
.

Sean Fahey
- 1,850
- 3
- 26
- 36
-
I am running Ubuntu, but I already did this yesterday. And the problem remained unsolved. So what I did: `cd /etc/apache2/sites-available` `sudo nano 000-default.conf` -> chaged it to: `DocumentRoot /var/www/html/BlueDrive_1/drive/public` – Alex Mar 09 '16 at 06:55