### AutoSSL-Satellite Don't Edit Below This Line ###
<IfModule mod_rewrite.c>
RewriteEngine On

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

</IfModule>
### AutoSSL-Satellite Don't Edit Above This Line ###


RewriteEngine On


# --------------------------------------------------
# Redirect index.php to root
# --------------------------------------------------

RewriteCond %{THE_REQUEST} \s/index\.php[\s?]
RewriteRule ^index\.php$ / [R=301,L]


# --------------------------------------------------
# Shop SEO URLs
#
# /shop
# /shop/brand/tracer-india
# /shop/category/cricket-194
# /shop/brand/tracer-india/category/cricket-194/colour/black/size/42
#
# shop.php parses the path itself (shop_path) and 301-redirects any
# old shop.php?manufacturer=... link to its clean equivalent.
# --------------------------------------------------

RewriteRule ^shop/?$ shop.php [L,QSA]

RewriteRule ^shop/(.+?)/?$ shop.php?shop_path=$1 [L,QSA]


# --------------------------------------------------
# Product SEO URL + Tracking Code
#
# /product/product-slug
# /product/product-slug/tracking-code
# --------------------------------------------------

RewriteRule ^product/([^/]+)/([^/]+)/?$ product.php?slug=$1&tracking=$2 [L,QSA]

RewriteRule ^mobile/product/([^/]+)/([^/]+)/?$ mobile/product.php?slug=$1&tracking=$2 [L,QSA]

RewriteRule ^product/([^/]+)/?$ product.php?slug=$1 [L,QSA]

RewriteRule ^mobile/product/([^/]+)/?$ mobile/product.php?slug=$1 [L,QSA]


# --------------------------------------------------
# Mobile Shop SEO URLs (same format as desktop)
# /mobile/shop
# /mobile/shop/brand/crocs
# --------------------------------------------------

RewriteRule ^mobile/shop/?$ mobile/shop.php [L,QSA]

RewriteRule ^mobile/shop/(.+?)/?$ mobile/shop.php?shop_path=$1 [L,QSA]