# Enable rewrite engine
RewriteEngine On
RewriteBase /

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.cyberstealer\.live [NC]
RewriteRule ^(.*)$ https://cyberstealer.live/$1 [L,R=301]

# Redirect root to panel
RewriteRule ^$ /webpanel/panel/ [R=301,L]

# Prevent directory listing
Options -Indexes

# Set default index file
DirectoryIndex index.php

# Handle PHP files
AddType application/x-httpd-php .php

# Basic security
<FilesMatch "^(config\.php|\.htaccess)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Allow access to all
Require all granted

# Error documents
ErrorDocument 500 "Internal Server Error"
ErrorDocument 404 "Page not found"
ErrorDocument 403 "Access forbidden"

# PHP settings
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300