RewriteEngine On

# Cho phép truy cập các file và thư mục tồn tại
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Chuyển hướng tất cả request đến public/index.php
RewriteRule ^(.*)$ public/index.php?url=$1 [QSA,L]

# Bảo mật - chặn truy cập trực tiếp vào các file nhạy cảm
<FilesMatch "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
    Order allow,deny
    Deny from all
</FilesMatch>

<FilesMatch "(composer\.json|composer\.lock|\.htaccess)">
    Order allow,deny
    Deny from all
</FilesMatch>