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

grabovacnem's avatar

Can't open routes after moving files to server

I just moved my laravel files to server, I put them all inside the public_html , and my hosting company provided me with index.php files. Now the problem is I can't acces my website if I dont type exact route, like www.example.com/home, if it is www.example.com/ it doesnt work.

I have a route defined in laravel, route / to send me to my home view, but when i visit that route it sends me to www.example.com/public_html ,where my laravel project is located. How do I fix it? :/

My .htaccess file:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
0 likes
3 replies
tomopongrac's avatar

I think that your hosting company need to add index.php to DirectoryIndex in httpd.conf file

grabovacnem's avatar

@tomi They provided index.php files, idk if this is what ur referring to:

$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';

Please or to participate in this conversation.