Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel routes are not working on production server 404 error

I have a laravel project, which is working fine on the local machine, where I have it set up on homestead, but when I have uploaded project to the production server on namecheap, none of the links or routes are working, I only get the index page open with no style, and if I click on any of the links I get 500 error. I have follow the suggested steps here:

So, my laravel project directory is in the same level as public_html, as well as public directory from my laravel project. They are all in the same directory level. And I have changed the paths in the index.php file:

require __DIR__.'/mariva/bootstrap/autoload.php';
$app = require_once __DIR__.'/mariva/bootstrap/app.php';

Then, I have changed the server.php inside the laravel project directory:

require_once __DIR__.'../public_html/index.php';

Permission were set apparently by the namecheap customer service, but I still get 404 error for all my css and js files, as well as when clicking on some html links on my page.

In the view file I am calling my css files like this:

<!-- CSS Files -->
  <link href="{{ asset('css/material-kit/css/bootstrap.min.css') }}" rel="stylesheet" />
  <link href="{{ asset('css/material-kit/css/material-kit.css') }}" rel="stylesheet"/>
  <link href="{{ asset('css/landing-page.css') }}" rel="stylesheet"/>

And js file the same way:

<!--   Core JS Files   -->
<script src="{{ asset('js/landing-page/jquery.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/landing-page/bootstrap.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/landing-page/material.min.js') }}"></script>

<!-- Control Center for Material Kit: activating the ripples, parallax effects, scripts from the example pages etc -->
<script src="{{ asset('js/landing-page/material-kit.js') }}" type="text/javascript"></script>

Not sure how can I fix that?

Update

I have managed to fix the css and js issue of not opening the files, I have moved the files to the wrong directory by mistake. But I still can't get any links on the page to work?

In my view I have links like this one:

<a href="{{ url('/login') }}">Login</a>

And when clicking on them I get 404 error.

like image 200
Ludwig Avatar asked Jan 16 '17 14:01

Ludwig


1 Answers

the problem may be in the trusted hosts

try setting this in your .env

APP_URL=http://
like image 89
Yevgeniy Afanasyev Avatar answered Oct 11 '22 06:10

Yevgeniy Afanasyev