mardi 21 février 2017

Laravel installation in subfolder

I have a laravel installation in a subfolder on my local development server as well as Voyager admin generator. It is located on 192.168.1.101/laravel/

Configuration goes like this:

Apache2

Alias /laravel /home/dev/laravel/public
<Location /laravel>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted  
</Location>

.env

APP_URL=http://ift.tt/2lqw4gR

.htaccess

<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 ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ /laravel/index.php [L]

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

voyager.php

'assets_path' => '/laravel/vendor/tcg/voyager/assets',

With this configuration voyager can't load some assets because the link generated looks like this.

 http://ift.tt/2kHkwZm

If I change the assets_path to be without /laravel the assets now have a link like this and again wont load, but the asset above loads correctly now.

http://ift.tt/2lqtG9I 

If I make a change to any of these options some things become broken and some become fixed.

How do I properly configure apache and laravel for it to work in a subdirectory?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kHfHiX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire