this might help
Sep 8, 2023
3
Level 2
Why laravel app cannot access other pages except welcome page in sharedhosting hostinger
hello i try to host laravel app to hostinger sharedhosting. I place laravel app folder beside public_html folder
folder structure
--. -- public_html
|_ index.php
-- laravelapp
|_ .htacess
in public_html . has all public folder files because i deleted public folder . i changed index.php as
if (file_exists($maintenance = __DIR__.'/../laravelapp/storage/framework/maintenance.php')) {
require $maintenance;
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../laravelapp/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../laravelapp/bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Request::capture()
)->send();
$kernel->terminate($request, $response);
and .htacess file is in root of laravel app
RewriteEngine On
RewriteBase /
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/ [L,NC]
when i access to domain , it can access welcome page but cannot access login/register page .
Oops, looks like the page is lost.
This is not a fault, just an accident that was not intentional.
something wrong in htacess ?? or folder structures? please help
Please or to participate in this conversation.