Jump to content

Prestashop 1.6.1.9


Sanitaria

Recommended Posts

Hi, i am using Prestashop 1.6.1.9, i am using nginx and enabled friendly url.

When i upload any attachment sucesfull, when i try to download it redirect to the wrong url... saying No input file specified.

example:

1) click download attachment

2) it redirect to https://www.test.com/en/index.php?controller=attachment&id_attachment=1  saying no file specified

3) if i use the same link without "/en" part it work and i can download the file "

https://www.test.com/index.php?controller=attachment&id_attachment=1"

 

Anyone know how to fix this?

Link to comment
Share on other sites

I have the impression you are trying this in a custom module or custom theme, this could be the cause.

I am using the original prestashop theme...i just installed prestashop on a vps and i am using nginx, friendly urls work great, except for attachment download, i think the issue is regarding friendly urls, there is a way for fix this?

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

I tried using that code on nginx but is not working,

actually i am using

 

server {
    listen 80;
    listen 443 ssl;
    server_name www.sanitariacamporomano.com sanitariacamporomano.com;
    ssl_certificate /etc/nginx/sanitaria-certificato.pem;
    ssl_certificate_key /etc/nginx/sanitaria-key.pem;
    root /var/www/sanitariacamporomano.com;
    access_log /var/log/nginx/sanitaria.access.log;
    error_log /var/log/nginx/sanitaria.error.log;
    client_max_body_size 2M;
 
    index index.php index.html; # Letting nginx know which files to try when requesting a folder
 
 
    location = /favicon.ico {
        log_not_found off;      # PrestaShop by default does not provide a favicon.ico
        access_log off;         # Disable logging to prevent excessive log sizes
    }
 
 
     location = /robots.txt {
         auth_basic off;        # Whatever happens, always let bots know about your policy
         allow all;
         log_not_found off;     # Prevent excessive log size
         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;
    }
 
    ##
    # Gzip Settings
    ##
 
    gzip on;
    gzip_disable "msie6";                                             # Do people still use Internet Explorer 6? In that case, disable gzip and hope for the best!
    gzip_vary on;                                                     # Also compress content with other MIME types than "text/html"
    gzip_types application/json text/css application/javascript;      # We only want to compress json, css and js. Compressing images and such isn't worth it
    gzip_proxied any;
    gzip_comp_level 6;                                                # Set desired compression ratio, higher is better compression, but slower
    gzip_buffers 16 8k;                                               # Gzip buffer size
    gzip_http_version 1.0;                                            # Compress every type of HTTP request
     
    rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
    rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2.jpg last;
    rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3.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.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.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.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.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.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.jpg last;
    rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
    rewrite ^/c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1.jpg last;
    rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
    try_files $uri $uri/ /index.php?$args;
 
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_keep_conn on;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}
 

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

malachiel, there's no reason to duplicate this nginx rule per language. the one block is enough  :rolleyes:

location ~* "^/[a-z]{2}/index.php" {
    rewrite ^(.*)$ /index.php?$args last;
}

I've faced the same trouble this fall & been forced to code the solution above

I've also included this block into my port of config to run presta 1.6 w/ nginx. the port is based on original settings & restrictions from prestashop bundle aimed at apache httpd, you're welcome to review & download or clone it at my github https://github.com/juliyvchirkov/nginx-prestashop/blob/master/fpm-prestashop.conf

 

regards,

juliy

 

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