Skip to content

Instantly share code, notes, and snippets.

@alabamaair
Last active March 20, 2016 04:55
Show Gist options
  • Save alabamaair/91d4d0833fbdb469bb0a to your computer and use it in GitHub Desktop.
Save alabamaair/91d4d0833fbdb469bb0a to your computer and use it in GitHub Desktop.
Rewrite rules for multilinguage Prestashop (nginx)
rewrite ^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg last;
rewrite ^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg last;
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$1$2.jpg last;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\.jpg$ /img/c/$1.jpg last;
rewrite ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/(/it|gb|de|fr|ru|es)/product/([0-9]+)\-[a-zA-Z0-9-]* /product.php?id_product=$1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/product/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]* /product.php?id_product=$1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+ /category.php?id_category=$1&noredirect=1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 last;
rewrite ^/(/it|gb|de|fr|ru|es)/content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 last;
rewrite ^/page-not-found$ /404.php last;
rewrite ^/address$ /address.php last;
rewrite ^/addresses$ /addresses.php last;
rewrite ^/authentication$ /authentication.php last;
rewrite ^/best-sales$ /best-sales.php last;
rewrite ^/cart$ /cart.php last;
rewrite ^/contact-us$ /contact-form.php last;
rewrite ^/discount$ /discount.php last;
rewrite ^/guest-tracking$ /guest-tracking.php last;
rewrite ^/order-history$ /history.php last;
rewrite ^/identity$ /identity.php last;
rewrite ^/brands$ /manufacturer.php last;
rewrite ^/my-account$ /my-account.php last;
rewrite ^/new-products$ /new-products.php last;
rewrite ^/order$ /order.php last;
rewrite ^/order-follow$ /order-follow.php last;
rewrite ^/quick-order$ /order-opc.php last;
rewrite ^/order-slip$ /order-slip.php last;
rewrite ^/password-recovery$ /password.php last;
rewrite ^/prices-drop$ /prices-drop.php last;
rewrite ^/search$ /search.php last;
rewrite ^/sitemap$ /sitemap.php last;
rewrite ^/stores$ /stores.php last;
rewrite ^/supplier$ /supplier.php last;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment