Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sanypratama's avatar

[laravel error] Not Found the requested URL / on this server

im uploading my website to my hosting and this is happens https://pasteboard.co/HrxF592.png

did someone knew how to fix it ? thanks

0 likes
9 replies
bobbybouwmann's avatar

Your domain should point to the public directory. Maybe your hosting provider can help you set that up!

Also it's highly recommended to run your application on some server where you have SSH access. Shared hosting is not ideal for application build with Laravel!

sanypratama's avatar

@bobbybouwmann my domain already point to public i think, its my first time upload some website in hosting and i dont know how to setup it, and this domain is from my teacher to upload my project to here, and i dont know how to fix it :(

BishoyWagih's avatar

if you are using shared hosting then do the following..

1 - move all files from public folder to root directory

2 - update index.php file..

replace

require __DIR__.'/../vendor/autoload.php';

with

require __DIR__.'/vendor/autoload.php';

and

$app = require_once __DIR__.'/../bootstrap/app.php';

with

$app = require_once __DIR__.'/bootstrap/app.php';
sanypratama's avatar

@BishoyWagih how to know, if this hosting is shared or not ? coz i have my own public_html and my own domain, thanks

BishoyWagih's avatar

did you install apache or nginx on your server? or you find it already installed.

if you didn't install it then you are using shared hosting

try my solution if it works for you, then you are using a shared hosting.

sanypratama's avatar

@BishoyWagih i just have all this in my public/index.php

/**

/* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | */

require DIR.'/../skripsi/bootstrap/autoload.php';

/* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */

$app = require_once DIR.'/../skripsi/bootstrap/app.php';

/* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle( $request = Illuminate\Http\Request::capture() );

$response->send();

$kernel->terminate($request, $response);

BishoyWagih's avatar

move this file outside public folder to root directory

update

require DIR.'/../skripsi/bootstrap/autoload.php';

to

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

update

$app = require_once DIR.'/../skripsi/bootstrap/app.php';

to

$app = require_once DIR.'/bootstrap/app.php';
sanypratama's avatar

@BishoyWagih what file i need to move from public folder to root, can u be specific ? sorry about my question, im really new in dis hosting and uploading :(

Please or to participate in this conversation.