Jump to content

1.6 nginx friendly url "my account" redirect to "login?back=my-account" 404 error


Recommended Posts

Hi,
 
I am using version 1.6.0.14, hosting on vps, nginx server and enabled ssl.
I want to use friendly url to get rid of the ugly '/index.php'.
But there are always errors, broken links after I turned on 'friendly url' in back office.
I searched for solutions on google for quite a long time, but still cannot make it work.
 
I tried looking into: http://stackoverflow.com/questions/23070441/prestashop-nginx-rewrite-rules
and 
http://stackoverflow.com/questions/25540059/prestashop-1-6-nginx-ssl-multilingual-site-rewrite-rules
 
But I still get the problem that my-account page is redirected to "login?back=my-account" (why is that? I cannot find any clue in rewrite rules), which leading to 404 error. Anyone please help to solve the problem, thanks!
 
 
Here is part of my nginx conf file:

    location / {
        index index.php index.html;
    }

    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
        access_log        off;
        log_not_found     off;
        expires           360d;
    }

    location ~ /\. {
        access_log off;
        log_not_found off;
        deny all;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
    rewrite "^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/(.*)\.jpg$" /img/c/$1$2.jpg last;
    rewrite "^/c/([_a-zA-Z-]+)/(.*)\.jpg$" /img/c/$1.jpg last;
    rewrite "^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/(\P{M}\p{M}*)*\.jpg$" /img/p/$1-$2$3.jpg last;
    rewrite "^/([0-9]+)\-([0-9]+)/(\P{M}\p{M}*)*\.jpg$" /img/p/$1-$2.jpg last;
    rewrite "^/([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$1$2.jpg last;
    rewrite "^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$1$2$3.jpg last;
    rewrite "^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.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-]*)?/(\P{M}\p{M}*)*\.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-]*)?/(\P{M}\p{M}*)*\.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-]*)?/(\P{M}\p{M}*)*\.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-]*)?/(\P{M}\p{M}*)*\.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-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
    rewrite "^/([0-9]+)\-(\P{M}\p{M}*)+\.html(.*)$" /index.php?controller=product&id_product=$1$3 last;
    rewrite "^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=category&id_category=$1$3 last;
    rewrite "^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$" /index.php?controller=product&id_product=$2$4 last;
    rewrite "^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$" /index.php?controller=supplier&id_supplier=$1$3 last;
    rewrite "^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$" /index.php?controller=manufacturer&id_manufacturer=$1$3 last;
    rewrite "^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=cms&id_cms=$1$3 last;
    rewrite "^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=cms&id_cms_category=$1$3 last;
    rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

    rewrite ^/page-not-found$ /index.php?controller=404 last;
    rewrite ^/address$ /index.php?controller=address last;
    rewrite ^/addresses$ /index.php?controller=addresses last;
    rewrite ^/authentication$ /index.php?controller=authentication last;
    rewrite ^/best-sales$ /index.php?controller=best-sales last;
    rewrite ^/cart$ /index.php?controller=cart last;
    rewrite ^/contact-us$ /index.php?controller=contact-form last;
    rewrite ^/discount$ /index.php?controller=discount last;
    rewrite ^/guest-tracking$ /index.php?controller=guest-tracking last;
    rewrite ^/order-history$ /index.php?controller=history last;
    rewrite ^/identity$ /index.php?controller=identity last;
    rewrite ^/manufacturers$ /index.php?controller=manufacturer last;
    rewrite ^/my-account$ /?controller=authentication&back=my-account last;
    rewrite ^/new-products$ /index.php?controller=new-products last;
    rewrite ^/order$ /index.php?controller=order last;
    rewrite ^/order-follow$ /index.php?controller=order-follow last;
    rewrite ^/quick-order$ /index.php?controller=order-opc last;
    rewrite ^/order-slip$ /index.php?controller=order-slip last;
    rewrite ^/password-recovery$ /index.php?controller=password last;
    rewrite ^/prices-drop$ /index.php?controller=prices-drop last;
    rewrite ^/search$ /index.php?controller=search last;
    rewrite ^/sitemap$ /index.php?controller=sitemap last;
    rewrite ^/stores$ /index.php?controller=stores last;
    rewrite ^/supplier$ /index.php?controller=supplier last;

    location ~* \.(gif)$ {
        expires 2592000s;
    }

    location ~* \.(jpeg|jpg)$ {
      expires 2592000s;
    }

    location ~* \.(png)$ {
        expires 2592000s;
    }

    location ~* \.(css)$ {
        expires 604800s;
    }

    location ~* \.(js|jsonp)$ {
        expires 604800s;
    }

    location ~* \.(js)$ {
        expires 604800s;
    }

    location ~* \.(ico)$ {
        expires 31536000s;
    }

    # php-fpm configuration
    location ~ .php$ {
        root /home/yimei;
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 4k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }

Link to comment
Share on other sites

  • 2 months later...

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...