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

legylith's avatar

Need help to deploy My Laravel Website to Online destination

Hi, I recently coded a quick website using laravel 5.3.

Its working on local environment.

I don't really understand the docs about going from dev to prod environment.

What do i need to change.

I use 1and1 shared hosting.

Local settings are Lamp basic settings from last version.

Thx

0 likes
11 replies
JoaoSantos's avatar

If 1and1 has lamp installed all you have to do is move all your files from local to 1and1 server and everything should be working the same. You can then, in .env file change APP_ENV=local to APP_ENV=production and APP_DEBUG=true to false. You can also minimize your assets, cache your routes and other optimizations.

Also don't forget to set up your database in the production server.

1 like
legylith's avatar

@JoaoSantos

Ok so I moved the files, but on local environment, I was manually going to /public to display the app. How do I get the users to be redirected to public directory ?

So I tried and the index was working fine, but any other route registered would return a not found error.

JoaoSantos's avatar

Your website address should point to your public folder. You can normally change where it points too in the shared hosting configurations. In case you cannot change this you have to change your index.php file so that it point's correctly to your bootstrap folder.

1 like
legylith's avatar

@JoaoSantos So it is working for the index page... but any other route is giving me this :

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

You can check for yourself :

http://ghislaine.lm-jules.com

JoaoSantos's avatar

Can you change APP_ENV to local and APP_DEBUG to true again? Or check storage/logs/laravel.log or other .log files to see more about the error.

francisaac's avatar

you have to config:

1: virtual host to point to app/public 2: enable rewriting of urls (most likely to be this one) 3: configure your .env file accordingly your production settings

legylith's avatar

Symfony\Component\Debug\Exception\FatalErrorException: Trait 'Illuminate\Database\Eloquent\Concerns\HasAttributes' not found in /homepages/25/d628556828/htdocs/ghislaine/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:20 Stack trace: #0 {main} [2017-02-02 15:25:13] production.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Trait 'Illuminate\Database\Eloquent\Concerns\HasAttributes' not found in /homepages/25/d628556828/htdocs/ghislaine/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:20 Stack trace: #0 {main} [2017-02-02 15:25:21] production.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Class 'Illuminate\Foundation\Support\Providers\AuthServiceProvider' not found in /homepages/25/d628556828/htdocs/ghislaine/app/Providers/AuthServiceProvider.php:8 Stack trace: #0 {main} [2017-02-02 15:25:24] production.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Class 'Illuminate\Foundation\Support\Providers\AuthServiceProvider' not found in /homepages/25/d628556828/htdocs/ghislaine/app/Providers/AuthServiceProvider.php:8 Stack trace: #0 {main} [2017-02-02 15:25:24] production.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Interface 'Illuminate\Contracts\Auth\Access\Gate' not found in /homepages/25/d628556828/htdocs/ghislaine/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php:10 Stack trace: #0 {main}

JoaoSantos's avatar
Level 3

Try to change your .htaccess that is in the public folder to something like this:

Options -MultiViews

RewriteEngine On

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteRule .? %{ENV:BASE}/index.php [L]

1 like
legylith's avatar

My .htacces file in public folder ooks like this :

Options -MultiViews

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

My .env looks like this :

APP_ENV=production APP_KEY= APP_DEBUG=false APP_LOG_LEVEL=debug APP_URL=http://ghislaine.lm-jules.com

DB_CONNECTION=mysql DB_HOST= DB_PORT= DB_DATABASE= DB_USERNAME= DB_PASSWORD=

BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379

MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=null

PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= ?>

JoaoSantos's avatar

You are welcome! I also had that problem with some shared hosts and found the solution in this forum some years back. Good luck with it!

Please or to participate in this conversation.