Jump to content

problem with friendly URL in 1.7.1.2 in nginx


dorayminail

Recommended Posts

hello,

I use the 1.7.1.2 and with nginx web server. But i can not enable friendly URL.

 

And, i found a guide of 1.6 which about how to enable it with nginx.  

Here is the link:

http://doc.prestashop.com/display/PS16/System+Administrator+Guide#SystemAdministratorGuide-NginxfriendlyURLs

 

And i find my nginx.conf is like this:

https://nginx.org/en/docs/example.html

 

They are totally different.

 

How can i enable friendly url with nginx? 

Link to comment
Share on other sites

  • 1 year later...
On 6/12/2017 at 9:08 AM, dorayminail said:

hello,

I use the 1.7.1.2 and with nginx web server. But i can not enable friendly URL.

 

And, i found a guide of 1.6 which about how to enable it with nginx.  

Here is the link:

http://doc.prestashop.com/display/PS16/System+Administrator+Guide#SystemAdministratorGuide-NginxfriendlyURLs

 

And i find my nginx.conf is like this:

https://nginx.org/en/docs/example.html

 

They are totally different.

 

How can i enable friendly url with nginx? 

 

Did you find how? All my ajax requests fail when I activate friendly URL in my nginx server with prestashop v1.7.4.2

Link to comment
Share on other sites

  • 3 weeks later...
5 hours ago, dinesh badrukhiya said:

Have you enabled mod_rewrite mode from your server? It is necessary to enable mod_rewrite mode to use friendly url.

 

I am using nginx with the recommended config file. As far as I know this feature does not exist on nginx (this functionalities must be rewriten in config file as rewrite rules and this has been already done). The thing here is that with the same config I can run prestashop 1.6 with friendly URLs enabled without any issue, but I need to stay at v1.7.x.

Link to comment
Share on other sites

On 9/16/2018 at 11:16 PM, dinesh badrukhiya said:

Check your server config file with below, I hope it will help you.

Nginx Server Configuration file for Prestashop

Best regards.

 

I appreciate your help, but my nginx config file is already based on that file.

I am able to enable friendly URLs in prestashop 1.7.4.2, I can even see product full details pages, but every single ajax request (like product color change or "see details" at home page) fail when friendly URLs are enbled. I have no idea what could fix this issue. 

Link to comment
Share on other sites

18 minutes ago, Julian R. said:

 

I appreciate your help, but my nginx config file is already based on that file.

I am able to enable friendly URLs in prestashop 1.7.4.2, I can even see product full details pages, but every single ajax request (like product color change or "see details" at home page) fail when friendly URLs are enbled. I have no idea what could fix this issue. 

 

This is bug in Prestashop 1.7.4.2. Try solution given in this pull request on github : Pull request #9390 - github

If not works then wait for Prestashop 1.7.5 release, coming soon in October. Pull request merged in next version.

Link to comment
Share on other sites

  • 5 years later...

Now on 2024 I have not found a clear answer for this problem, so I'm contributing with my cents:

I was running Prestashop locally on localhost/myprestashop, so the recommended nginx config doesn't work as expected. When I change Prestashop to run purely on localhost/ (in alternative port in my specific case, localhost:81/), it works perfectly.

Going deep, the magic lines of nginx are:

  root /var/www/myprestashop

  # Redirect pretty urls to index.php
  try_files $uri $uri/ /index.php$is_args$args;

  rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
  rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$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])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
  rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
  rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...