How To Upload A Laravel Project To A Shared Hosting THE RIGHT WAY

How To Upload A Laravel Project To A Shared Hosting THE RIGHT WAY



A2hosting! Best for laravel apps!

In this video, I’m going to show you how to deploy your laravel project to a shared hosting server the right way via the .htaccess file. in this way, you don’t break the structure of your application by moving files from folder to folder.

44 thoughts on “How To Upload A Laravel Project To A Shared Hosting THE RIGHT WAY

  1. Muy mal "way" de hacerlo, expones todo el proyecto laravel en la carpeta public_html. Lo mejor es dejar el proyecto fuera de esta carpeta, y solo colocar en public_html el contenido de la carpeta public de laravel.

  2. To access assets folder:
    root folder:
    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
    Options -MultiViews
    </IfModule>

    RewriteEngine On

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    </IfModule>

    public folder:
    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
    Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    </IfModule>

  3. hi! what about the assets <img src="{{asset($pic)}}" > doesn't work nor <img src="public/{{asset($pic)}}">

  4. Hello,
    Thank you four your Help , But there is a problem , it work correctly for me , but without asset , and when i see url of asset it look like this : mydomaine.com/img/1.jpg , actualy it should be : mydomaine.com/public/img/1.jpg , please what should i do ?

  5. If you do it this way your .env will be visible to the outside world! To protect your .env add this to the .htaccess file:

    # Disable index view
    Options -Indexes

    # Hide a specific file
    <Files .env>
    Order allow,deny
    Deny from all
    </Files>

  6. I have some problem after upload. It is saying welcome view not found. InvalidArgumentException in FileViewFinder.php line 137:
    View [welcome] not found.

  7. Thanks for the guide. Although I'm not hosting through a hosting site, but my private server, I managed to set it up thanks to the information in your guide.

Leave a Reply

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