# Disable directory browsing
Options -Indexes

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------

# Turning on the rewrite engine is necessary for the following rules and features.
<IfModule mod_rewrite.c>
    RewriteEngine on

    # Ensure Authorization header is passed along
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteRule ^index.php$ app/index.php [NC,L]

    # If the request is not for a valid file/directory/link
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^ app/index.php [NC,L]
</IfModule>
