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

    # Uploaded files must never be able to run scripts when browsed directly
    <IfModule mod_headers.c>
        <If "%{REQUEST_URI} =~ m#/storage/#">
            Header always set Content-Security-Policy "default-src 'none'; style-src 'unsafe-inline'; sandbox"
            Header always set X-Content-Type-Options "nosniff"
        </If>
    </IfModule>

    RewriteEngine On

    # Uncomment this if you need to access '/server-info' or '/server-status' urls to monitor apache2
    # RewriteRule ^(server-info|server-status) - [L]

    # Uncomment and set the RewriteBase path to the desired subdirectory if you want to
    # serve 2FAuth from a domain subdirectory like https://mydomain/2fauth/
    #
    # WARNING: the subdirectory value must match the one set in your .env file
    # Do not forget leading and trailing slashes.
    #RewriteBase /subdir/

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

    # Handle X-XSRF-Token Header
    RewriteCond %{HTTP:x-xsrf-token} .
    RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    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>