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

# Specific redirections
if ($args ~* ^add_to_wishlist=185$){ rewrite ^//?$ /add_to_wishlist-185/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=185$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-185/? permanent; }
if ($args ~* ^add_to_wishlist=178$){ rewrite ^//?$ /add_to_wishlist-178/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=178$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-178/? permanent; }
if ($args ~* ^add_to_wishlist=161$){ rewrite ^//?$ /add_to_wishlist-161/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=161$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-161/? permanent; }
if ($args ~* ^add_to_wishlist=147$){ rewrite ^//?$ /add_to_wishlist-147/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=147$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-147/? permanent; }
if ($args ~* ^add_to_wishlist=68$){ rewrite ^//?$ /add_to_wishlist-68/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=68$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-68/? permanent; }
if ($args ~* ^add_to_wishlist=35$){ rewrite ^//?$ /add_to_wishlist-35/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=35$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-35/? permanent; }
if ($args ~* ^add_to_wishlist=18$){ rewrite ^//?$ /add_to_wishlist-18/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=18$){ rewrite ^//?$ /action-yith-woocompare-add-product-id-18/? permanent; }
if ($args ~* ^add_to_wishlist=185$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/add_to_wishlist-185/? permanent; }
if ($args ~* ^add_to_wishlist=147$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/add_to_wishlist-147/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=147$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/action-yith-woocompare-add-product-id-147/? permanent; }
if ($args ~* ^add_to_wishlist=18$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/add_to_wishlist-18/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=18$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/action-yith-woocompare-add-product-id-18/? permanent; }
if ($args ~* ^add_to_wishlist=161$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/add_to_wishlist-161/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=161$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/action-yith-woocompare-add-product-id-161/? permanent; }
if ($args ~* ^add_to_wishlist=35$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/add_to_wishlist-35/? permanent; }
if ($args ~* ^action=yith-woocompare-add-product&id=35$){ rewrite ^/product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/?$ /product/acs-mat-acupressure-reflexology-magnetic-pyramidal-therapy-energy-pain-relief-power-foot-health-deluxe-mats/action-yith-woocompare-add-product-id-35/? 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
