I have problem when upload it to Share Hosting
When I upload laravel + filament to Share Hosting, when I go to domain.com/admin, it show 404. Is there something that I have to do after upload the project?
16 Replies
Make sure this code implement in User model
public function canAccessPanel(Panel $panel): bool
{
return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
}
https://filamentphp.com/docs/3.x/panels/usersShared hosting and Laravel are often a bad combination. It's hard to tell because there might be numerous issues with the server setup
It can work if having ssh terminal available. Your problem might be because of .htaccess, can you acces via /public/admin?
I'll try
I just have this account to make a light blog. To make this web secure I used to move the project directory in the outside of public_html
I cant π¦
as Dennis said, shared hosting is rubbish with laravel.. its not worth it for the money you are saving
You need to point the virtual host to
public
then
If you can't change the virtual host config, you will need to jump through some hoops.I think theres a problem when I upload it, so I reinstall the Filament via cpanel terminal. Everything goes fine even when I make filament-user. When I check the database there is my user data, but I cant access the admin page
Can you access any Laravel route?
Okay I will try it
Yes I can, just the filament page I cant access
have you tried adding this code to the User model?
public function canAcces Panel(Panel $panel): bool { return true; }
Yes I modified the User model like in Documentation and like this, still same (404)
Solution
Finally I fix it, I config the htaccess in the wrong way π
i have same problem in shared hosting can give me the htaccess config π’
Stop trying to hack around htaccess...
On most shared hostings, it's easy to install laravel: you just need to put your site in the root directory (outside public_html), and make your domain point to the
public
dir
But you need ssh on your server to install composer packages, deploy, etc.
If you only have ftp access, find another hosting provider, it's not worth itif you have no SSH access then you can just upload the /vendor too.
but as mentioned such hostings not worth the effort unless you have no other options
but a Digital Ocean droplet with the best cheap alternative.
agree, but sometimes copying the vendor through ftp won't work, depending on the config/packages. And someday you'll regret not having ssh.