Jump to content

404 on Prestashop 1.5 under nginx [Solved]


Recommended Posts

I have a problem with nginx giving a 404 error on a Prestashop 1.5.4.1 site.

 

This is the URL returning the 404: www.domain.com/es/index.php?controller=order-confirmation

 

The prestashop is under multilanguage enviroment. Then I have:

 

www.domain.com/en/

www.domain.com/es/

www.domain.com/fr/

www.domain.com/de/

 

The URL rewriting runs fine, except when the url have the "index.php". Then nginx returns the 404.

 

I think the problem is on nginx virtualhost configuration, but I don't know what it's failing.

 

My nginx configuration: http://pastebin.com/CFQ5hwNX

 

That nginx configuration runs perfect on a Prestashop with only 1 domain (without the /lang/ on the url).

 

Nginx version: 1.4.0

Edited by anmaral79 (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  • 2 months later...
  • 2 months later...

Hi, 

 

You can add this rules in nginx rewrite rules just before the "try_files $uri $uri/ /index.php$is_args$args;" lines.

 

It can help if you enable multilanguage prestashop mode and it fixes a lot other buggy links like : 

/en/index.php?controller=order-confirmation
/en/index.php?controller=pdf-invoice

The line to add in your nginx configuration : 

rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1; 

Cheers, 

  • Like 1
Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...
  • 3 weeks later...

Hi, 

 

You can add this rules in nginx rewrite rules just before the "try_files $uri $uri/ /index.php$is_args$args;" lines.

 

It can help if you enable multilanguage prestashop mode and it fixes a lot other buggy links like : 

/en/index.php?controller=order-confirmation
/en/index.php?controller=pdf-invoice

The line to add in your nginx configuration : 

rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1; 

Cheers, 

 

 

Hi kernity

Can you help more with this problem please? I try to get my 3 stores working on nginx for a second day now...

 

you wrote: just before the "try_files $uri $uri/ /index.php$is_args$args;" lines....

 

my nginx config does not have this

 

 

where should I put your code?

rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1;

 

 

I have tried PS TEAM solution here: http://doc.prestashop.com/display/PS16/System+Administrator+Guide#SystemAdministratorGuide-NginxfriendlyURLs

but its rubbish

it doesnt work either.

 

thanks

Link to comment
Share on other sites

Hi, 

 

Here you can more about my nginx configuration for the shop. You can see where to put the line.

       
.....
       rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
       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;
       rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
       rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1;
       try_files $uri $uri/ /index.php$is_args$args;
       error_page 404 /index.php?controller=404;
.......
Edited by kernity (see edit history)
Link to comment
Share on other sites

  • 2 months later...

It can help if you enable multilanguage prestashop mode and it fixes a lot other buggy links like : 

/en/index.php?controller=order-confirmation
/en/index.php?controller=pdf-invoice

I got it all working using the seo%urls page, Take a look at some examples on the page, it is not too hard to do yourself.

CC

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...