Connect with us

Easy way to Host your Laravel Application on Shared Hosting

kizinho

Published

on

Follow
DEVELOPER PROGRAMMING: Easy way to Host your Laravel Application on Shared Hosting [New  Developer Programming] » Naijacrawl
Photo: Naijacrawl
site

Hi , Folks have you finished building that your awesome project but hosting it o shared hosting is what remains, don't worry you are on the right track, I have the best way to do that.

Steps

  1. Create Database on your online cpanel
  2. Upload your project or use git to do that
  3. Set everything up on your ENV
  4. now we need .htaccess that you will create inside your laravel root folder


Inside the .htaccess add this code

RewriteEngine On#endsRewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ public/index.php [L]

Replace with your domain

What this code does is that when you host your laravel application and access it, it will show the user the original folder of your project, unless you go to the public before it can load the project as a web but now enjoy hosting with shared hosting after following the above steps.

Enjoy and share

Click Here To Comment


site


kizinho

Adike Kizito is a top-rated software developer, blogger, sports, and entertainment lover. He is the CEO of these popular websites Naijacrawl.com and Mp3ager.com. He operates his software developing task through Kizzsoft.com,... Read More

Continue Reading
Click to comment

Be first to comment


    Leave a Reply

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

    Laravel 9 Release Date and New Features

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: Laravel 9 Release Date and New Features [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl
    Laravel community has updated about the new release of another version of Laravel called laravel 9. With laravel 9 it brings new features that you will love and it will be released earlier next year in 2022 due to some dependencies of Symphony they depend on which will be available by November 2021 and Laravel normally gives 2 months after symphony updates to release a new version of laravel.Let's look at the new features Laravel introduced a new query builder which...
    Continue Reading

    Mastering laravel Routes

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: Mastering laravel Routes [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl
    Hi, folks, we have successfully mastered MVC in the last class, if you missed it go back here.We have talked about routes and where they can be found in the project, will do a quick freshened up in routes.Laravel routes simply accept a URI and a Closure, providing a very simple and expressive method of defining routes:Before we start using a route, take note of the following :Available Router Methodsget - you use get when you want to get resources from the databasep...
    Continue Reading

    How to Customize Laravel Validator Error with Reusable Functions

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: How to Customize Laravel Validator Error with Reusable Functions [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl
    Laravel is a powerful PHP framework that helps you to build a web application quickly. Laravel is very easy to use and maintain the codebase, I will advise using the latest version of laravel when building a new project.Read Also : How to solve This page isn’t working HTTP ERROR 500 in LaravelToday I will show how you can customize the laravel validator error and reused it when validating your requests and return a nice error message to the user.Example functionsuse...
    Continue Reading

    Latest


    Download Naijacrawl App today

    Fastest way to ready on the go

    Download the Naijacrawl App.