This may be good for help:
URL: http://ekal.mydomain/events/index ERROR: 404
My web.php
Route::get('/events/index', 'EventsController@index');
I have found that login and register works only. URL is
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello All,
I am new to Laravel and this is my first post. I have problem with deployment my app to hosting. I have Forbidden error or Not Found due to path problems.
Here is my steps how I did it:
My Laravel app is working on Valet development environment on MacOS well at /Users/tomas/laravel/ekal and is available at http://ekal.dev locally. Database is mySQL at localhost.
I did login to DirectAdmin v1.50.1 my hosting and created virtual domain "ekal.mydomain.com" located on server at path : /domains/mydomain.com/public_html/ekal/
Compress local ekal app directory to ekal.zip file and FTP it to hosting under server path /domains/mydomain.com/public_html/ekal/ekal.zip
I uncompress ZIP file to the same path.
I did edit /domains/mydomain.com/public_html/ekal/.env file and change database setting to right one.
APP_URL=http://ekal.mydomain.com
DB_CONNECTION=mysql
DB_HOST=mydomain.com
DB_PORT=3306
DB_DATABASE=ekal
DB_USERNAME=ekal
DB_PASSWORD=secret
I did export my database from local server to SQL file, and upload this to my hosting via PHPmyAdmin as database ekal.
I edit file /domains/mydomain.com/public_html/ekal/config/app.php and change:
'url' => env('APP_URL', 'http://ekal.mydomain.com'),
7. I change permissions to 777 for /domains/mydomain.com/public_html/ekal/storage/framework
That all.
When I open web browse and type URL ekal.mydomain.com i see Forbidden error 403.
When I open ekal.mydomain.com/public I see my APP first page. But when i click on any link like "/users/index" app try to load URL : ekal.mydomain.com/users/index.php and can't find it with error Not Found 404.
I have notice that, CSS files are not loaded. So i did move from
/domains/mydomain.com/public_html/ekal/public/css
to one level up to path
/domains/mydomain.com/public_html/ekal/css
and see that APP can now find the file app.css and web page have CSS elements in DOM.
This help me to load CSS files, but do not solve problem with others.
I did search for solution, and found that proper way for deploy app is to upload all files on level up over public_html directory. Like this:
cd /domains/mydomain.com/public_html/ekal
cd /domains/mydomain.com/public_html <--------upload here
UPLOAD app files here
DELETE ekal
MOVE public -> ekal
But in my case i can't do that.
I can't upload files to upper level.
/domains/mydomain.com/public_html/ekal is root URL for ekal.mydomain.com
/domains/mydomain.com/public_html is root URL for whole virtual server, i can't modify it.
I can't edit apache.config files.
I have only FTP access to hosting and DirectAdmin web admin.
My question is how to modify configuration of laravel APP itself to works?
You can try it with .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ekal.mydomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.ekal.mydomain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
But I'm not sure if this works fine... This simulates the document root to /public.
Please or to participate in this conversation.