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

megamitch's avatar

index.php is not in the public folder

I've done uploaded my fresh laravel project into a web hosting. Now it shows only a blank page. I use the pre-built login stuff in the laravel 5 and the link will is http://mylaravel.mywebhost.com/auth/login even if I enter http://mylaravel.mywebhost.com/public/index.php (as you know, index.php is in the public folder) and I didn't point my subdomain into the public folder. Any ideas, recommendations, clues, suggestions, help to make my laravel 5 work in my subdomain. Currently, I think it is because the index.php is in the public folder and my subdomain did not point in the public folder so the best way is to put the index.php outside the public but how I'm going to tell the laravel 5 that the index.php is outside the public folder like /index.php so that everything works again?

0 likes
6 replies
pmall's avatar

The root of your webserver must be the public directory. if you can't configure it you should consider to change your web hosting.

bashy's avatar

You should point your subdomain to the public folder...

megamitch's avatar

I see, thanks for the quick answer. Anyway, is there any way to make things work if I put the index.php outside the public folder, e.g. /index.php

taijuten's avatar

There isn't, and this would be a security issue as it could potentially give a user access to the rest of your application files.

heoquay99's avatar

move your index.php to your path you want then edit in index.php

require __DIR__.'/../bootstrap/autoload.php'; //Path to your autoload.php
$app = require_once __DIR__.'/../bootstrap/app.php'; // Path to your app.php
bashy's avatar

Be careful moving the index file up a level since anything above public can be viewed publicly.

You would want to maybe make use of symlinks to get around this.

Please or to participate in this conversation.