RewriteEngine On
RewriteBase /

# ----------------------------------------
# Remove .php from URL
# ----------------------------------------
RewriteCond %{THE_REQUEST} \s/([^.]+)\.php[\s?] [NC]
RewriteRule ^ %1 [R=301,L]

# ----------------------------------------
# Handle pages without .php
# ----------------------------------------
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-]+)/?$ $1.php [L]

# ----------------------------------------
# Product URLs
# ----------------------------------------
RewriteRule ^products/([a-zA-Z0-9-]+)/?$ service-details.php?slug=$1 [L,QSA]

# ----------------------------------------
# Blog detail URLs
# ----------------------------------------
RewriteRule ^blogs/([a-zA-Z0-9-]+)/?$ blog-details.php?slug=$1 [L,QSA]

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
