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?
3 Answers
Everything was from the .htaccess file. I added AllowOverride All and everything is ok now!
2 Comments
Praditha
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)
Kevin Glick
I'm having this exact same problem. How does your .htaccess file look? Where did you add AllowOverride All?
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>
Comments
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.
1 Comment
Alex
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
http://yourdomain.com/public? If that's the case, you need to change the HTTP server's Document Root to point to thepublicdirectory of your application. Your URL paths should not containpublicwithin them.