jeudi 4 juillet 2019

Laravel application + vuejs Admin panel apache configuration

I have a Laravel apps with a vuejs admin panel. My goals is all routes match /admin will return the index.html of vue app

structure folder

backend -> public -> admin (a symlink who redirect to /dist of vue application).

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}]

    # Handle Front Controller...
    RewriteCond %{REQUEST_URI} !^/admin
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

If the route are /, /blog/, /contact, etc ... I want to use laravel router,

else if the route are /admin, /admin/dashboard, etc ... I want to send index.html of the vuejs app.

Hope you can help me.

I tried many other config of .htaccess.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire