RewriteEngine On

# Agar file ya folder asli mein exist karta hai, to wahi kholo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# SEO Friendly URL Rule:
# URL: yoursite.com/mobile/12/samsung-galaxy-s24
# Server samjhega: details.php?id=12
RewriteRule ^mobile/([0-9]+)/?(.*)$ details.php?id=$1 [L,QSA]

# Error Page (Agar page na mile to home par bhej do)
ErrorDocument 404 /index.php

# Sitemap Rewrite Rule
RewriteRule ^sitemap\.xml$ sitemap.php [L]

# Baki rules (jo pehle se the, unhe waise hi rehne dein)...
# Example for clean URL logic if you have it:
# RewriteRule ^mobile/([0-9]+)/([a-zA-Z0-9-]+)$ details.php?id=$1 [L]