Hightmar Posted December 8, 2019 Share Posted December 8, 2019 (edited) Hello, I just installed PS and I have a problem with NGINX and URL rewriting. I followed a lot of tutoring but nothing to do. This part of the code keeps redirecting me to the index all the time. try_files $uri $uri/ /index.php?$args; So there's nothing I can do. Has anyone who has ever had the problem ever solved it? Thank you. With this code it's almost ok. The URL are right rewritten # Prestashop rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; 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-]*)\.html(.*)$ /product.php?id_product=$1$3 last; rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1$3 last; rewrite ^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 last; rewrite ^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 last; rewrite ^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 last; rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1$3 last; rewrite ^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms_category=$1$3 last; rewrite ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last; rewrite ^/page-non-trouvee(.*)$ /404.php$1 last; rewrite ^/adresse(.*)$ /address.php$1 last; rewrite ^/adresses(.*)$ /addresses.php$1 last; rewrite ^/authentification(.*)$ /authentication.php$1 last; rewrite ^/meilleures-ventes(.*)$ /best-sales.php$1 last; rewrite ^/panier(.*)$ /cart.php$1 last; rewrite ^/contactez-nous(.*)$ /contact-form.php$1 last; rewrite ^/bons-de-reduction(.*)$ /discount.php$1 last; rewrite ^/suivi-commande-invite(.*)$ /guest-tracking.php$1 last; rewrite ^/historique-des-commandes(.*)$ /history.php$1 last; rewrite ^/identite(.*)$ /identity.php$1 last; rewrite ^/marques(.*)$ /manufacturer.php$1 last; rewrite ^/mon-compte(.*)$ /my-account.php$1 last; rewrite ^/nouveaux-produits(.*)$ /new-products.php$1 last; rewrite ^/commande(.*)$ /order.php$1 last; rewrite ^/details-de-la-commande(.*)$ /order-follow.php$1 last; rewrite ^/commande-rapide(.*)$ /order-opc.php$1 last; rewrite ^/avoirs(.*)$ /order-slip.php$1 last; rewrite ^/mot-de-passe-oublie(.*)$ /password.php$1 last; rewrite ^/promotions(.*)$ /prices-drop.php$1 last; rewrite ^/recherche(.*)$ /search.php$1 last; rewrite ^/plan-du-site(.*)$ /sitemap.php$1 last; rewrite ^/magasins(.*)$ /stores.php$1 last; rewrite ^/fournisseurs(.*)$ /supplier.php$1 last; But I got instead of my product File not found. Edited December 8, 2019 by Hightmar (see edit history) Link to comment Share on other sites More sharing options...
selectshop.at Posted December 8, 2019 Share Posted December 8, 2019 Which tuto you followed ? Using SSL ? Writing permissions correct set ? Tried this one ? https://github.com/MattLoyeD/Prestashop-Nginx Using docker ? https://github.com/PrestaShop/PrestaShop/pull/9047/files You already deleted the smarty and browser cache as well ? The configuration of this files depends also on the configuration of your server, so it's very customized and individual. Link to comment Share on other sites More sharing options...
Hightmar Posted December 9, 2019 Author Share Posted December 9, 2019 Hello, Thank you for the answer. I finally managed to get the friendly URLs to work. I have a NGINX/Apache configuration, I ended up bypassing Nginx for this site because the images didn't work. The thing now is that the site only works in developer mode, otherwise it doesn't work. Probably because the installation was always crashing in the same place on the server, I installed PS locally and uploaded it all. 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