dimanche 25 octobre 2020

Laravel make routing to subfolder on deploy

I have a Laravel Apps and a shared hosting. I wanted to deploy my Laravel apps to cpanel, and got an error

404 resources not found when deployed. I have put the laravel public folder into the root folder, and the laravel file into subfolder /laravelApp.

So my hosting structured like this :

bdd.services
|--> public_html
|----> myLaravelApp
|------> css
|------> js
|------> laravelApp
|--------> app
|--------> /* and all the laravel apps inside here */
|------> .htaccess
|------> index.php
|
|
|----> someonesProject

When I tried to test the app, I see the request was requesting to https://mydoamin.com/login/auth where it should be https://mydoamin.com/myLaravelApp/login/auth. So it shows an error 404 resources not found.

So how to make the routing always go to https://mydoamin.com/myLaravelApp/? or maybe there's another solution?

here's my .htaccess

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

    RewriteEngine On

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

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>



Aucun commentaire:

Enregistrer un commentaire