RewriteEngine On

# لو الملف موجود فعلاً، شغّله عادي
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# ✅ توجيه ملفات HTML إلى public لو لم تكن موجودة
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/public/$1 -f
RewriteRule ^(.+\.html)$ public/$1 [L]



RewriteEngine On

# لو الملف موجود فعلاً شغله عادي
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteEngine On

# لو الملف موجود فعلاً، شغّله عادي
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# توجيه أي طلب لملف .html غير موجود إلى verify.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.html$ [NC]
RewriteRule ^(.*\.html)$ public/verify.php?file=$1 [L]



<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # يدعم اللغات التي تحتوي على حرفين أو ثلاثة مثل "fil"
    RewriteCond %{REQUEST_URI} ^/([a-z]{2,3})$ [NC]
    RewriteRule ^(.*)$ %{REQUEST_SCHEME}://%{HTTP_HOST}/%1/ [R=301,L]

    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1 

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ public/index.php [L]

    # إعادة توجيه /ph/ إلى /fil/
    RewriteCond %{REQUEST_URI} ^/ph(/.*)?$ [NC]
    RewriteRule ^ /fil%1 [R=301,L]

    # إعادة توجيه /gr/ إلى /el/
    RewriteCond %{REQUEST_URI} ^/gr(/.*)?$ [NC]
    RewriteRule ^ /el%1 [R=301,L]

    # إعادة توجيه /jp/ إلى /ja/
    RewriteCond %{REQUEST_URI} ^/jp(/.*)?$ [NC]
    RewriteRule ^ /ja%1 [R=301,L]

    # إعادة توجيه /hi/ إلى /
    RewriteCond %{REQUEST_URI} ^/hi/?(.*)$ [NC]
    RewriteRule ^ /%1 [R=301,L]
    
    
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType video/mp4 "access plus 1 year"
  ExpiresByType video/mpeg "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

<IfModule php8_module>
   php_flag display_errors Off
   php_value max_execution_time 500
   php_value max_input_time 120
   php_value max_input_vars 3000
   php_value memory_limit 512M
   php_value post_max_size 128M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php81"
   php_value upload_max_filesize 20M
   php_flag zlib.output_compression Off
</IfModule>

<IfModule lsapi_module>
   php_flag display_errors Off
   php_value max_execution_time 500
   php_value max_input_time 120
   php_value max_input_vars 3000
   php_value memory_limit 512M
   php_value post_max_size 128M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php81"
   php_value upload_max_filesize 20M
   php_flag zlib.output_compression Off
</IfModule>

<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
