RewriteEngine On

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

# 2. Opsional: Jika ingin menyeragamkan (Redirect www ke non-www)
# Ini akan membuat semua akses ke www.bray.idnototo77.shop 
# otomatis diarahkan ke bray.idnototo77.shop
RewriteCond %{HTTP_HOST} ^www\.bray\.idnototo77\.shop [NC]
RewriteRule ^(.*)$ https://bray.idnototo77.shop/$1 [L,R=301]

# 3. Pastikan sitemap.xml selalu diakses langsung ke sitemap.php
RewriteRule ^sitemap\.xml$ sitemap.php [L]

# 4. Pengecualian Googlebot agar tidak diredirect ke /m/
RewriteCond %{HTTP_USER_AGENT} !(googlebot|bingbot|slurp|duckduckbot|baiduspider|yandexbot) [NC]
RewriteCond %{REQUEST_URI} !^/m/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /m/$1 [L]
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php84” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-alt-php84___lsphp .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
