<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    ServerSignature Off

    ########################################
    # 1️⃣ Force HTTPS + Remove WWW
    ########################################

    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteRule ^ https://baryabco.ir%{REQUEST_URI} [L,R=301]

    ########################################
    # 2️⃣ Allow Static Assets (including fonts)
    ########################################

    RewriteRule ^(.*)\.(css|js|png|jpg|jpeg|gif|svg|webp|ico|woff|woff2|ttf|eot|ico)$ public/$1.$2 [L]

    ########################################
    # 3️⃣ Block Direct Access To Sensitive Files
    ########################################

    RewriteCond %{REQUEST_URI} \.(html|php|xml|txt|md|pdf)$ [NC]
  RewriteRule ^ - [F]

    ########################################
    # 4️⃣ Route All Other Requests
    ########################################

    RewriteRule ^ public/server.php [L]

</IfModule>

# php handler (cpanel)
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>
