<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^(excotel\.com|www\.excotel\.com)$ [NC]
RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1)(:\d+)?$ [NC]
RewriteRule ^ https://excotel.com%{REQUEST_URI} [R=301,L,NE]

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

# File yang diubah saat migrasi ke excotel.com dilayani lokal, bukan dari CDN
RewriteRule ^assets/js/editor-preview\.js$ - [L]
RewriteRule ^assets/(.*)$ https://exhotel.b-cdn.net/assets/$1 [R=302,L,NE]

RewriteRule ^login/?$ /login.php [L]
RewriteRule ^register/?$ /register.php [L]
RewriteRule ^forgot-password/?$ /forgot-password.php [L]
RewriteRule ^google-auth/?$ /google-auth.php [L]
RewriteRule ^my-account/?$ /my-account.php [L]
RewriteRule ^my-stay/?$ /my-stay.php [L]
RewriteRule ^logout/?$ /logout.php [L]
RewriteRule ^privacy-policy/?$ /privacy-policy.php [L]
RewriteRule ^privacy/?$ /privacy-policy.php [L]
RewriteRule ^delete-account/?$ /delete-account.php [L]
RewriteRule ^blog/?$ /blog/index.php [L]
RewriteRule ^blog/([^/]+)/?$ /blog/index.php?slug=$1 [L,QSA]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


</IfModule>
