# Redirect non-www to www

# Add a trailing slash (/) to a URL
rewrite ^([^.]*[^/])$ $1/ permanent;

# Specific redirections
if ($args ~* ^sort=name-az$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/product-cat/mobiles/?$ /product-cat/mobiles/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/product-cat/laptops/?$ /product-cat/laptops/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/product-cat/drone/?$ /product-cat/drone/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/product-cat/digital-cameras/?$ /product-cat/digital-cameras/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/product-cat/dslr-cameras/?$ /product-cat/dslr-cameras/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/all-products/?$ /all-products/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/all-products/?$ /all-products/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/all-products/?$ /all-products/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/all-products/?$ /all-products/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/all-products/?$ /all-products/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/all-products/?$ /all-products/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/all-products/?$ /all-products/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/all-products/?$ /all-products/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/samsung/?$ /brand/samsung/sort-name-az/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/samsung/?$ /brand/samsung/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/samsung/?$ /brand/samsung/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/samsung/?$ /brand/samsung/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/samsung/?$ /brand/samsung/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/samsung/?$ /brand/samsung/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/apple/?$ /brand/apple/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/apple/?$ /brand/apple/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/apple/?$ /brand/apple/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/apple/?$ /brand/apple/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/apple/?$ /brand/apple/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/apple/?$ /brand/apple/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/apple/?$ /brand/apple/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/apple/?$ /brand/apple/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/nokia/?$ /brand/nokia/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/nokia/?$ /brand/nokia/sort-rating-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/htc/?$ /brand/htc/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/htc/?$ /brand/htc/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/htc/?$ /brand/htc/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/htc/?$ /brand/htc/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/htc/?$ /brand/htc/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/htc/?$ /brand/htc/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/htc/?$ /brand/htc/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/htc/?$ /brand/htc/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/sony/?$ /brand/sony/sort-name-az/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/lg/?$ /brand/lg/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/lg/?$ /brand/lg/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/lg/?$ /brand/lg/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/lg/?$ /brand/lg/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/lg/?$ /brand/lg/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/lg/?$ /brand/lg/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/lg/?$ /brand/lg/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/lg/?$ /brand/lg/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/motorola/?$ /brand/motorola/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/qmobile/?$ /brand/qmobile/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/hp/?$ /brand/hp/sort-name-za/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/hp/?$ /brand/hp/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/hp/?$ /brand/hp/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/huawei/?$ /brand/huawei/sort-name-za/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/huawei/?$ /brand/huawei/sort-rating-hl/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/oppo/?$ /brand/oppo/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/canon/?$ /brand/canon/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/canon/?$ /brand/canon/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/canon/?$ /brand/canon/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/canon/?$ /brand/canon/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/canon/?$ /brand/canon/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/canon/?$ /brand/canon/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/canon/?$ /brand/canon/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/canon/?$ /brand/canon/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/nikon/?$ /brand/nikon/sort-name-az/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/nikon/?$ /brand/nikon/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/dji/?$ /brand/dji/sort-price-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/dji/?$ /brand/dji/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/vivo/?$ /brand/vivo/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/brand/infinix/?$ /brand/infinix/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/product-cat/bangladesh/?$ /product-cat/bangladesh/sort-reviews-lh/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/mobiles/page/2/?$ /product-cat/mobiles/page/2/sort-name-za/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/product-cat/mobiles/page/3/?$ /product-cat/mobiles/page/3/sort-name-za/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/mobiles/page/2/?$ /product-cat/mobiles/page/2/sort-price-hl/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/product-cat/mobiles/page/3/?$ /product-cat/mobiles/page/3/sort-price-hl/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/mobiles/page/2/?$ /product-cat/mobiles/page/2/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/product-cat/mobiles/page/3/?$ /product-cat/mobiles/page/3/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-name-za/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/all-products/page/3/?$ /all-products/page/3/sort-name-za/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/all-products/page/4/?$ /all-products/page/4/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/all-products/page/4/?$ /all-products/page/4/sort-price-lh/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-price-hl/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/all-products/page/3/?$ /all-products/page/3/sort-price-hl/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/all-products/page/4/?$ /all-products/page/4/sort-price-hl/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/all-products/page/3/?$ /all-products/page/3/sort-reviews-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/all-products/page/2/?$ /all-products/page/2/sort-reviews-lh/? permanent; }
if ($args ~* ^huajax=1$){ rewrite ^//?$ /huajax-1/? permanent; }
if ($args ~* ^s=\%7Bsearch_term_string\%7D$){ rewrite ^//?$ /s-{search_term_string}/? permanent; }
if ($args ~* ^sort=price-hl$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-price-hl/? permanent; }
if ($args ~* ^sort=reviews-lh$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-reviews-lh/? permanent; }
if ($args ~* ^s=\%s$){ rewrite ^/blog/?$ /blog/s--s/? permanent; }
if ($args ~* ^s=\%7Bsearch_term_string\%7D$){ rewrite ^/blog/?$ /blog/s-{search_term_string}/? permanent; }
if ($args ~* ^sort=name-az$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-name-az/? permanent; }
if ($args ~* ^sort=name-za$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-name-za/? permanent; }
if ($args ~* ^sort=price-lh$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-price-lh/? permanent; }
if ($args ~* ^sort=rating-hl$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-rating-hl/? permanent; }
if ($args ~* ^sort=rating-lh$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-rating-lh/? permanent; }
if ($args ~* ^sort=reviews-hl$){ rewrite ^/all-products/page/5/?$ /all-products/page/5/sort-reviews-hl/? permanent; }
if ($args ~* ^mid=1$){ rewrite ^/autocopysingle\.php$ /autocopysingle.php/mid-1/? permanent; }

# Create pretty URLs
rewrite ^/([^/]+)/$ /$1.html last;
rewrite ^/([^/]+)/([^/]+)/$ /$1/$2.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7/$8.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7/$8/$9.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7/$8/$9/$10.html last;
# End: Create pretty URLs

# Redirect all extensions to html
if ($is_args = ''){
	rewrite ^([^.]*)\.shtml$ $1.html permanent;
	rewrite ^([^.]*)\.phtml$ $1.html permanent;
	rewrite ^([^.]*)\.jhtml$ $1.html permanent;
	rewrite ^([^.]*)\.htm$ $1.html permanent;
	rewrite ^([^.]*)\.php$ $1.html permanent;
	rewrite ^([^.]*)\.aspx$ $1.html permanent;
	rewrite ^([^.]*)\.asp$ $1.html permanent;
	rewrite ^([^.]*)\.jsp$ $1.html permanent;
	rewrite ^([^.]*)\.apk$ $1.html permanent;
}
# End: Redirect all extensions to html
