# Namijind CMS Pro - Clean URL / Rewrite Fix
# This file must be placed in the same public root folder as index.php.

Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # ------------------------------------------------------------
    # Canonical domain for ArewaStory
    # Force HTTPS and non-www:
    # https://arewastory.com.ng/
    # ------------------------------------------------------------
    RewriteCond %{HTTPS} !=on [OR]
    RewriteCond %{HTTP_HOST} !^arewastory\.com\.ng$ [NC]
    RewriteRule ^ https://arewastory.com.ng%{REQUEST_URI} [R=301,L,NE]

    # ------------------------------------------------------------
    # Block old/removed admin and legacy folders
    # ------------------------------------------------------------
    RewriteRule ^SHU-Admin(/.*)?$ - [F,L]
    RewriteRule ^shuraih(/.*)?$ - [F,L]
    RewriteRule ^shuraih\.php$ - [F,L]

    # ------------------------------------------------------------
    # Protect private application folders/files
    # ------------------------------------------------------------
    RewriteRule ^(app|config|Controllers|src|Template|database|storage|Log|logs|vendor|namijind-license)(/|$) - [F,L]

    RewriteRule (^|/)\.env$ - [F,L]
    RewriteRule \.(sql|bak|backup|back|old|orig|save|swp|ini|log)$ - [F,L]
    RewriteRule ^(composer\.(json|lock)|package(-lock)?\.json|yarn\.lock|webpack\.config\.js)$ - [F,L]

    # ------------------------------------------------------------
    # Do not rewrite real files or real folders
    # ------------------------------------------------------------
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # ------------------------------------------------------------
    # Send clean URLs to the PHP router
    # ------------------------------------------------------------
    RewriteRule ^ index.php [QSA,L]
</IfModule>

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

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