3
votes

1. Uploaded my files to 000webhost. I placed all files from the public folder to public_html then I created a folder named laravel and there I uploaded all other files. This is the structure of my directory:

laravel

app

bootstrap

config

....

public_html

index.html

.....

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

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

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

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

Problem:

I am now able to access the home page of my site, but when I click my links to the other pages error 404 shows up.

How do I fix this?

And how do I access the routes in my api.php ?

Thanks!

2

2 Answers

3
votes

Your includes seem fine.

Be sure you also uploaded the .htaccess file located in /public (in your /public_html). The file name starts with a dot so it's commonly hidden. The purpose of this file is to indicate Apache how to map URLs to real files (in this case, everything should point to index.php)

0
votes

Try changing the index.php file. Change it as the following:

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

This should solve the problem.