Connect with us

Easy way to Host your Laravel Application on Shared Hosting




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

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.


  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.)?$
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1RewriteCond %{HTTP_HOST} ^(www.)?$
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



I am a software developer, like meeting people and love blogging, that's why I developed naijacrawl because that's what I love doing.

Continue Reading
Click to comment

Be first to comment

    Leave a Reply

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

    Laravel Absolute Beginners Masterclass




    DEVELOPER PROGRAMMING: Laravel Absolute Beginners Masterclass [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl

    Hi, folks you are welcome to laravel absolute beginner masterclass, if you are here to learn how laravel works, I will recommend you to visit laravel website here but if you are here to use laravel build a product, you are very welcome. Laravel is a PHP Framework

    What is a Framework?

    Before I dive into explaining Laravel, you will need to understand what is a framework. In general, a Framework is a set of conceptual structure and guidelines, used to build a useful product without so much stress.

    What Laravel 

    Laravel is a web application framework with an expressive, elegant syntax which aims to make the development process a pleasing one for the developer without sacrificing application functionality. Laravel follows the MVC (Model View Controller) structure which makes it easy to learn and rapidly prototype the web applications


    1. PHP version from 7.2.5 and above
    2. Composer
    3. I will make use of latest laravel version 7.13 for this

    How to Install PHP

    Visit this link to download Xampp for your PHP, download based on your OS and install it.

    How to install Composer

    Visit this link to download composer for your OS, for window user click here, After downloading install the composer, you need to select the path for your PHP, the composer will alert you during the installation on windows.

    To check if your PHP and composer are successfully installed, open your command (cmd) and type PHP -v, you will see a screen like this

    PHP 7.3.5 (cli) (built: May 1 2019 13:17:17) ( ZTS MSVC15 (Visual C++ 2017) x64 )

    Copyright (c) 1997-2018 The PHP Group

    Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies

    Check for composer type on your cmd composer, a list of a variable will appear on the screen

    Laravel Installation Completion

    Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.

    First, download the Laravel installer using Composer:

    composer global require laravel/installer

    Creating a new project using - Create-Project

    1. first, go to your composer, the local disk you will see xampp -> htdocs-> create a new folder, right on the folder by holding shift + right click and follow the step below
    2. Install Laravel by issuing the Composer create-project command in your terminal:
    composer create-project --prefer-dist laravel/laravel SampleSite

    You have successfully installed your first project using laravel.

    Continue Reading

    How to show a nice message to the user when an error occurs in using Guzzle with Laravel




    DEVELOPER PROGRAMMING: How to show a nice message to the user when an error occurs in using Guzzle with Laravel [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl

    Hi Folks, have you encountered an ugly Exception when making a post, get, put, delete to external API when an error like 500 or 404 occurs. Today you are at the right place, after reading this you will be able to show a nice message to your users in case of any of those errors occurs

    When making a request to external API using guzzle to solve this problem you will need to catch the Exception by following the steps below.

    1. Prepare your request using Guzzle, I believe you know or have set it up already
    2. Make a post or get request to your external API
        public function create(Request $request) {
        $input = $request->all();
        try {
            $client = new Client();
            $headers = ['API-Key' => env('API_KEY')];
            $url = 'api/post/create';
            $response = $client->request('POST', $url, ['headers' => $headers, 'query' => $input]);
            $res = json_decode($response->getBody());
    //here will catch error to aviod ugly message to users  
        } catch (\GuzzleHttp\Exception\RequestException $res) {
            if ($res->hasResponse()) {
                $response = $res->getResponse();
                if ($response->getStatusCode() == 500) {
                } if ($response->getStatusCode() == 404) {

    Congrats , you have saved your users from seeing that ugly message . Share and comment

    Continue Reading

    Laravel 6 and 7 Package for Paystack




    NEWS: Laravel  6 and  7 Package for Paystack [New  Developer] » Naijacrawl
    Photo: Naijacrawl

    Hi, Folks since the release of laravel version 6 and 7, it is very difficult to easily use Paystack on it due to lack of maintenance but today unicodeveloper of the package have taken his time to release a new update on the package.

    To use it, you just need to follow the same pattern we normally do and get things working back again.

    Visit the package URL here

    Continue Reading