Laravel / 00webhost error 404. The requested URL was not found on this server

1. Uploaded my files to 000webhost. I put all files from the shared folder in public_html , then I created a folder called laravel and there I downloaded all the other files. This is my directory structure:

Laravel

application

     

bootstrapping

     

configuration

     

....

public_html

index.html

     

.....

2. In my index.php file I have already changed some things to these

  •   
  • DIR required . '/../laravel/bootstrap/autoload.php';

      
  • $ app = require_once DIR . '/../laravel/bootstrap/app.php';

      

3. I also changed the .env and database.php file in the laravel / config folder

Problem:

Now I can access the home page of my site, but when I click links to other pages, a 404 error appears.

How to fix it?

     

And how do I access routes in api.php?

Thank!

+3


source to share


2 answers


Everything looks fine in your shows.



Make sure you also upload the .htaccess file located in / public (in your / public_html). The filename starts with a dot, so it is usually hidden. The purpose of this file is to tell Apache how to map urls to real files (everything should point to index.php in this case)

+3


source


Try changing your index.php file . Change it like this:

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

      



This should fix the problem.

0


source







All Articles