api/public/.htaccess

44 lines
1.7 KiB
ApacheConf

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
# @2x Detection - اولویت بالا برای کاشی‌های 512px
RewriteRule ^hot/(\d+)/(\d+)/(\d+)@2x\.png$ /ret/$1/$2/$3.png [L]
# اگه درخواست با /u شروع بشه، قوانین بعدی رو اعمال نکن و بذار فایل‌های اونجا مستقیماً لود بشن
RewriteCond %{REQUEST_URI} ^/u(/|$) [NC]
RewriteRule ^ - [L]
# اگه فایل یا دایرکتوری فیزیکی وجود داره (مثل فایل‌های استاتیک)، مستقیماً لودش کن
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# همه درخواست‌های دیگه رو به index.php سمفونی بفرست
RewriteRule ^ /index.php [L]
</IfModule>
# فعال‌سازی compression (اگر ماژول موجود باشد)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>
# تنظیم cache (اگر ماژول موجود باشد)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType text/css "access plus 1 hour"
ExpiresByType application/javascript "access plus 1 hour"
</IfModule>
# Basic Security Headers (if supported)
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
</IfModule>
# Custom error pages
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html