Deploy the laravel project on 1&1 production server

|
| By Webner

How to deploy the laravel project on Shared hosting server

On shared Environment:

Step 1: Push the code to Production Server.

I’m assuming that your project is running perfectly on your localhost and now you are ready to push it to production server on the shared environment (like 1and1 / ionos). Before pushing the code run following commands on your local machine.

:~$ php artisan route:clear
:~$ php artisan view:clear
:~$ php artisan cache:clear
:~$ php artisan config:cache

Now you can push the code on shared production server, Make sure “Vendor” folder is included with your code.

Step 2: Now goto https://my.1and1.com/ and set the Webspace directory “public”

Step 3: Now goto the production server and create the .htaccess file into /public folder with following directives-

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase /
    # 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}]
</IfModule>

Leave a Reply

Your email address will not be published. Required fields are marked *