Back

Can't acces route on live server


grabovacnem posted 8 months ago

Hello,

I have uploaded my laravel project to my web server, into the public_html folder and i got index.php files from my hosting company (they told me to do it like this). Now, I can access all of my routes except one, www.example.com , so the / or no / after .com, which should take me to home page, as it is set in my routes/controller, however it takes me to www.example.com/public_html which doesnt exist. Everything works locally but I dont know how to set up my .htaccess or index.php or something third, to make my website show homepage when i type my web address.

My .htaccess code:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

My index.php code :

$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';
mirbatworks replied 8 months ago

Check root directory path for your domain in C-Panel. You need to change it and navigate to your laravel-project-directory/public. Also, you need to set permission to 755 for storage directory and subdirectories and files to allow laravel to write log.


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us