# ============================================================================
# Gmind Institute — Main .htaccess
# Compatible with Apache and LiteSpeed
# Deployed at: https://advaysingh.co.in/gmind
# ============================================================================

# Disable directory listing (security)
Options -Indexes

# Default index file
DirectoryIndex index.php

# Enable rewrite engine
RewriteEngine On

# Set rewrite base for subdirectory deployment
RewriteBase /gmind/

# ============================================================================
# Block direct access to sensitive files
# ============================================================================

# Block access to hidden files (.env, .git, .htaccess backups, etc.)
RewriteRule ^\. - [F,L]

# Block access to composer files
RewriteRule ^composer\.(json|lock) - [F,L]

# Block access to README
RewriteRule ^README\.md - [F,L]

# ============================================================================
# Route all non-file requests through index.php
# ============================================================================

# If the request is not for an existing file, route through index.php
# Note: We do NOT use !-d (not directory) because real directories like
# /admin/, /app/, etc. should also be routed through index.php, not shown
# as directory listings. Only actual files (css, js, images) are served directly.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?route=$1 [QSA,L]
