RewriteEngine On
RewriteBase /

# ------------------------------------------------
# Force HTTPS + WWW
# ------------------------------------------------
#RewriteCond %{HTTPS} !=on [OR]
#RewriteCond %{HTTP_HOST} !^www\.gayatrisolarpower\.com$ [NC]
#RewriteRule ^ https://www.gayatrisolarpower.com%{REQUEST_URI} [L,R=301]

# ------------------------------------------------
# Skip admin and founder folders (NO rewrite here)
# ------------------------------------------------
RewriteCond %{REQUEST_URI} ^/(admin|founder)/ [NC]
RewriteRule .* - [L]

# ------------------------------------------------
# Custom URLs (KEEP THESE ABOVE .php RULES)
# ------------------------------------------------

# Service URL
RewriteRule ^service/([a-zA-Z0-9-]+)/?$ service-details.php?slug=$1 [L,QSA]

# Blog URL
RewriteRule ^blogs/([a-zA-Z0-9-]+)/?$ blog-single.php?slug=$1 [L,QSA]

# Location URL
RewriteRule ^locations/([a-zA-Z0-9-]+)/?$ location-details.php?slug=$1 [L,QSA]

# ------------------------------------------------
# Remove .php extension (SEO friendly)
# ------------------------------------------------
RewriteCond %{THE_REQUEST} \s/([^.]+)\.php[\s?] [NC]
RewriteRule ^([^.]+)\.php$ /$1 [R=301,L]

# ------------------------------------------------
# Internally load .php file
# ------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/?$ $1.php [L]

