# Đặt môi trường làm việc
SetEnv CI_ENV development
# Thiết lập ưu tiên cho tập tin Index
DirectoryIndex index.php index.html
# -------------- SEO URLS --------------
RewriteEngine on
# Allow requests for valid file or folder names, or some that should be
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond $1 ^(robots.txt|favicon.ico)
RewriteRule ^(.*)$ - [L]
# use index.php as front controller ...
RewriteRule ^(.*)$ ./index.php/$1 [L]
# -------------- Tối ưu hóa tài nguyên hệ thống --------------
# Đặt charset mặc định là utf-8
<Files ~ ".(htm|html|css|js|php)$">
AddDefaultCharset UTF-8
</Files>
# Bật nén file
<IfModule mod_deflate.c>
<FilesMatch ".(css|js|xml|ttf)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|ttf)$">
Header append Vary Accept-Encoding
</FilesMatch>
<FilesMatch ".(doc|pdf|swf)$">
Header set X-Robots-Tag "noarchive, nosnippet"
</FilesMatch>
<FilesMatch ".(js|css|jpe?g|png|gif|swf|svg|ico|woff|ttf|xsl|pdf|flv|mp3|mp4)(?[0-9]{9,11})?$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
</IfModule>
# Protect the htaccess file
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>
# Protect the dot file
<FilesMatch "^.">
Order allow,deny
Deny from all
</FilesMatch>
<Files composer.json>
Order Allow,Deny
Deny from all
</Files>
<Files composer.lock>
Order Allow,Deny
Deny from all
</Files>
# Disable directory browsing
Options All -Indexes