Options -Indexes

RewriteEngine On

# Make the bare subdomain open the home page automatically
DirectoryIndex home.php

# Remove .php from manually entered URLs
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule ^(.+)\.php$ /$1 [R=301,L]

# Bare domain → home.php
RewriteRule ^$ home.php [L]

# Simple clean URLs
RewriteRule ^([A-Za-z0-9_-]+)$ $1.php [L,QSA]

# Doctor routes
RewriteRule ^doctor/([A-Za-z0-9_-]+)$ doctor/$1.php [L,QSA]

# Clinician routes
RewriteRule ^clinician/([A-Za-z0-9_-]+)$ clinician/$1.php [L,QSA]

# Patient routes
RewriteRule ^patient/([A-Za-z0-9_-]+)$ patient/$1.php [L,QSA]

# Admin routes
RewriteRule ^admin/?$ admin/login.php [L,QSA]
RewriteRule ^admin/([A-Za-z0-9_-]+)$ admin/$1.php [L,QSA]

# 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
