3

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 Answers2

3

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)

Didier Sampaolo
  • 2,566
  • 4
  • 24
  • 34
  • Thanks! There was already an .htaccess file in the public_html folder when I created my site in 000webhost that's why i failed to copy the one in my local public folder. Thanks a lot! – Mary Nicole Aplita May 31 '17 at 03:39
0

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.

Tanvir Sourov
  • 417
  • 1
  • 6
  • 32