RewriteEngine On

# Handle Products
# /products/slug
RewriteRule ^products/([^/]+)/?$ product-detail.php?slug=$1 [L,QSA]

# Handle Collections
# This rule matches /collections/anything/slug or /collections/slug
# It grabs the last segment after the last slash as the slug
RewriteRule ^collections/(.+)/([^/]+)/?$ collection-detail.php?slug=$2 [L,QSA]
RewriteRule ^collections/([^/]+)/?$ collection-detail.php?slug=$1 [L,QSA]

# Prevent directory listing
Options -Indexes
