RewriteEngine On

RewriteCond %{HTTPS} !on
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

<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_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteRule ^(private-storage|external-storage)/ index.php [L]

    RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|gif|otf|ttf|woff|woff2|svg|txt)
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(css|js|fonts|imagenes|vendor)/(.*)$ public/$1/$2 [L,NC]
</IfModule>

<Files ~ "\.(yml|env|gitignore|gitattributes|example|json|lock|xml|mix.js|editorconfig|md|bk)$">
    Order allow,deny
    Deny from all
</Files>

<Files "artisan">
  Order Allow,Deny
  Deny from all
</Files>

