2

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?

2
  • 1
    So 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. Commented Mar 8, 2016 at 22:40
  • I pointed it right in the public directory and still gives me an error. Commented Mar 9, 2016 at 7:13

3 Answers 3

4

Everything was from the .htaccess file. I added AllowOverride All and everything is ok now!

Sign up to request clarification or add additional context in comments.

2 Comments

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)
I'm having this exact same problem. How does your .htaccess file look? Where did you add AllowOverride All?
2

If you are using apache server then do the following

  1. Go to your apache2.conf file, For example in ubuntu the path is /etc/apache2/apache2.conf
  2. 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

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.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.