xandrw Posted June 7, 2014 Share Posted June 7, 2014 (edited) Hello, I have installed Prestashop 1.6 recently on a nginx server and after i enable the friendly URLs feature, the product images don't show anymore. I have added this to my nginx configuration: location /shop/ { index /shop/index.php; rewrite ^/shop/api/?(.*)$ /shop/webservice/dispatcher.php?url=$1 last; rewrite ^/shop/([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$1$2.jpg last; rewrite ^/shop/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$2/$1$2$3.jpg last; rewrite ^/shop/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$2/$3/$1$2$3$4.jpg last; rewrite ^/shop/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last; rewrite ^/shop/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last; rewrite ^/shop/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last; rewrite ^/shop/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /shop/img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last; rewrite ^/shop/([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$ /shop/img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last; rewrite ^/shop/c/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /shop/img/c/$1$2.jpg last; rewrite ^/shop/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+.jpg$ /shop/img/c/$1.jpg last; rewrite ^/shop/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /shop/img/c/$1$2.jpg last; try_files $uri $uri/ /shop/index.php?$args; } I don't know what else to do really. The shop can be found at http://www.s7automation.com/shop/ Edited June 7, 2014 by xandrw (see edit history) Link to comment Share on other sites More sharing options...
WalTig Posted October 9, 2014 Share Posted October 9, 2014 I can see your shop is okay now. I'm curious how you fixed the problem with the images since I am facing the same problem now. Prestashop 1.6 on a nginx server and after i enable the friendly URLs feature, the product images don't show anymore. I have added the same configuration as you did. What was your soultion? Was it in the configuration (then: can you show me yours)? Or did you find the solution somewhere else? Link to comment Share on other sites More sharing options...
xandrw Posted October 9, 2014 Author Share Posted October 9, 2014 I can see your shop is okay now. I'm curious how you fixed the problem with the images since I am facing the same problem now. Prestashop 1.6 on a nginx server and after i enable the friendly URLs feature, the product images don't show anymore. I have added the same configuration as you did. What was your soultion? Was it in the configuration (then: can you show me yours)? Or did you find the solution somewhere else? I haven't solved the problem, I actually switched to Apache and then my boss told me to switch to Wordpress > Woocommerce... Sorry, hope you find a solution... try stackoverflow. Link to comment Share on other sites More sharing options...
WalTig Posted October 9, 2014 Share Posted October 9, 2014 (edited) Thanx for your fast response though. In the mean time I have found a solution. That is how things go all the time. A few minutes after placing a post I will find the solution. Already for that reason writing a post is valuable. I have read some posts about deleting and recreating .htaccess but IMHO that's nonsense (for this specific situation that is). This is what did the trick for me: Adding the following lines to the nginx configuration in the server{} block - which is not in the location / {} block (tried that block too but was not solving my problem): rewrite ^/api/?(.*)$ /$baseUri/dispatcher.php?url=$1 break; 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 ^/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 last; rewrite ^/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 last; rewrite ^/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+ /category.php?id_category=$1&noredirect=1 last; rewrite ^/([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 last; rewrite ^/([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 last; rewrite ^/([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 last; rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 last; rewrite ^/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 ^/manufacturers$ /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; Edited October 9, 2014 by WalTig (see edit history) 1 Link to comment Share on other sites More sharing options...
xandrw Posted October 9, 2014 Author Share Posted October 9, 2014 Thanks for the solution Link to comment Share on other sites More sharing options...
gdlug Posted March 26, 2015 Share Posted March 26, 2015 Thanks for the solution But this solution doesn't work for Prestashop being in subdirectory Link to comment Share on other sites More sharing options...
rraulinio Posted December 19, 2015 Share Posted December 19, 2015 Thanx for your fast response though. In the mean time I have found a solution. That is how things go all the time. A few minutes after placing a post I will find the solution. Already for that reason writing a post is valuable. I have read some posts about deleting and recreating .htaccess but IMHO that's nonsense (for this specific situation that is). This is what did the trick for me: Adding the following lines to the nginx configuration in the server{} block - which is not in the location / {} block (tried that block too but was not solving my problem): rewrite ^/api/?(.*)$ /$baseUri/dispatcher.php?url=$1 break; 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 ^/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 last; rewrite ^/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 last; rewrite ^/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+ /category.php?id_category=$1&noredirect=1 last; rewrite ^/([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 last; rewrite ^/([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 last; rewrite ^/([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 last; rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 last; rewrite ^/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 ^/manufacturers$ /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; Thanks for the solution. But you only need these lines for the images to work: 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; Link to comment Share on other sites More sharing options...
Lausli Posted May 23, 2016 Share Posted May 23, 2016 (edited) it dosent work with prestrashop 1.6.1.5 See here: https://www.prestashop.com/forums/topic/530264-nginx-seo-freundliche-urls/ anyone solved it ? Solved: https://www.prestashop.com/forums/topic/530264-nginx-seo-freundliche-urls/?do=findComment&comment=2331611 Edited May 23, 2016 by Lausli (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now