# Aktifkan mod_rewrite
RewriteEngine On

# Paksa HTTPS dan hapus WWW sekaligus
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

# Redirect domain lama jika ada (contoh)
# RewriteCond %{HTTP_HOST} ^old-pages3d\.net$ [NC]
# RewriteRule ^(.*)$ https://pages3d.net/$1 [L,R=301]

# Custom Error Pages (opsional)
# ErrorDocument 404 /404.html
# ErrorDocument 500 /500.html

# Tambahan keamanan opsional
# Lindungi .htaccess dan file sensitif lainnya
<FilesMatch "^.*(\.htaccess|\.htpasswd|\.ini|\.log|\.env)$">
    Require all denied
</FilesMatch>

# 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
