# Enable URL Rewriting
RewriteEngine On

# Set the base directory - adjust this to match your production path
# If your site is at https://yesweus.in/lagna2025/website/
RewriteBase /lagna2025/website/

# ============================================
# SEO-FRIENDLY CASTE-BASED URLs
# ============================================

# Basic caste matrimony pages
# Example: maratha-matrimony → caste_matrimony.php?caste=maratha
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-matrimony/?$ caste_matrimony.php?caste=$1 [L,QSA]

# Caste + Gender (Grooms)
# Example: maratha-grooms-seo → caste_matrimony.php?caste=maratha&gender=male
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-grooms-seo/?$ caste_matrimony.php?caste=$1&gender=male [L,QSA]

# Caste + Gender (Brides)
# Example: maratha-brides-seo → caste_matrimony.php?caste=maratha&gender=female
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-brides-seo/?$ caste_matrimony.php?caste=$1&gender=female [L,QSA]

# ============================================
# CITY-BASED URLs (SEO-Friendly)
# ============================================

# Caste + City
# Example: maratha-matrimony-mumbai → caste_matrimony.php?caste=maratha&location=mumbai
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-matrimony-([a-z]+)/?$ caste_matrimony.php?caste=$1&location=$2 [L,QSA]

# Caste + Gender + City (Grooms)
# Example: maratha-grooms-mumbai → caste_matrimony.php?caste=maratha&gender=male&location=mumbai
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-grooms-([a-z]+)/?$ caste_matrimony.php?caste=$1&gender=male&location=$2 [L,QSA]

# Caste + Gender + City (Brides)
# Example: maratha-brides-mumbai → caste_matrimony.php?caste=maratha&gender=female&location=mumbai
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-brides-([a-z]+)/?$ caste_matrimony.php?caste=$1&gender=female&location=$2 [L,QSA]

# ============================================
# DIVORCEE URLs (SEO-Friendly)
# ============================================

# Divorcee Grooms
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-divorcee-grooms-seo/?$ caste_matrimony.php?caste=$1&gender=male&marital_status=Divorced [L,QSA]

# Divorcee Brides
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-divorcee-brides-seo/?$ caste_matrimony.php?caste=$1&gender=female&marital_status=Divorced [L,QSA]

# ============================================
# DIVORCEE + CITY URLs (SEO-Friendly)
# ============================================

# Divorcee Grooms + City
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-divorcee-grooms-([a-z]+)/?$ caste_matrimony.php?caste=$1&gender=male&marital_status=Divorced&location=$2 [L,QSA]

# Divorcee Brides + City
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-]+)-divorcee-brides-([a-z]+)/?$ caste_matrimony.php?caste=$1&gender=female&marital_status=Divorced&location=$2 [L,QSA]
