0

I am developing an application on Laravel 5.2. I am done with development and deploying the application on a linux server. I moved the source code using git and executed migrations. I can see everything but when I access the project (any url) it gives 404 error.

The requested URL /project_name/public/ROUTE_NAME was not found on this server.

I checked apache logs, they say

Wed May 25 17:17:15 2016] [error] [client 172.16.17.15] File does not exist: /var/www/html/project_name/public/ROUTE_NAME

Let me know your thoughts.

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78
  • Do you have mod_rewrite on the server ? – Vasil Rashkov May 25 '16 at 12:28
  • @VasilShaddix would like to know about it, let me know what do I need to check. I have been deploying apps developer on other frameworks but this is the first time on laravel. – Danyal Sandeelo May 25 '16 at 12:29
  • what url you hit show your route file – D Coder May 25 '16 at 12:33
  • @Pradeep I have the routes in my routes.php, the same code is working fine on linux. That's something related to re-writing I guess. I didn't modify apache conf – Danyal Sandeelo May 25 '16 at 12:37
  • @VasilShaddix yes I can access it as /public/index.php/ROUTE_NAME but can't see the layout loaded ... only the form with broken css – Danyal Sandeelo May 25 '16 at 12:57
  • @VasilShaddix can't tag you in the answer down there. I can see in the answer that root directory has been modified.. Do I need to that as well? i don't want to point the root on this project since I have other projects there – Danyal Sandeelo May 25 '16 at 13:02
  • @DanyalSandeelo what you can do is `DocumentRoot "/var/www/html/" Allowoverride All ` no need to modify the document root. – Vasil Rashkov May 25 '16 at 13:05
  • 1
    @VasilShaddix Thanks man that worked..I can upvote you if you write your comment as answer – Danyal Sandeelo May 25 '16 at 13:14

1 Answers1

0

Possible problem is the missing of the module mod_rewrite on the apache.

https://httpd.apache.org/docs/current/mod/mod_rewrite.html

The routing system of laravel works on it. It just takes your url and does it's magic. But without this mode it wont work.

In your index.php in the public folder try

phpinfo();die();

To see if you have the mode activated.

If the mode is not active you can follow this instructions

https://stackoverflow.com/a/24354757/4969969

without the need to modify the entire document root folder of the server:

DocumentRoot "/var/www/html/" .... <Directory "/var/www/html/project_name/public"> Allowoverride All </Directory>

Community
  • 1
  • 1
Vasil Rashkov
  • 1,818
  • 15
  • 27