Jump to content

[Prestashop 1.7] No images when Firendly URL is active


Recommended Posts

Hi. I am new to Prestashop. I've just installed a clean version to test how Presta works. After installation I have notice that all sample product images are not shown. I have read that I might have a problem with friendly url. So I visited the back office and turned off  friendly urls and the product images are shown. But when I turn the urls on again the images disappear again. When I try open these images in new tab I have 404 Error. 

I have removed .htaccess file from the main directory and regenerated it by turning on Friendly URL but it did not help. It's hard to have a shop without images. Can anyone help me with that problem? 

 

EDIT

Problem solved. It was a server problem.

Edited by banan_44
Problem solved (see edit history)
Link to comment
Share on other sites

  • 3 months later...

Hello,

can you please help me? I have the same problem - what was the server problem?

I only get always "client denied by server configuration" and this say nothing to me.

Also Google Search doesn't help so far...

 

Greetings

AKW

 

Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...

I have the very same issue!

After a fresh install of 1.7.4.4 all sample product images are not shown, Create a new product and also did not display the product photo.
If I switch and turned off friendly urls then the product images are shown also the new one I just added, but when I turn the friendly urls on again the images disappear again.

The links works good, I really want to use the friendly url for better SEO but I cannot make it works as expected.

Here is the store:  shop.finedresser.com  I let the Friendly URL on so you can see the bad behavior.

First photo is Friendly URL = YES
Second photo is Friendly URL = NO

 

Screen_Shot_2018-12-11_at_6_44.43_AM.png

Screen_Shot_2018-12-11_at_6_45.33_AM.png

Link to comment
Share on other sites

  • 3 months later...
Just now, Dsousa said:

My issue was that the server was an Nginx, so the rewritable rules does not make sense on the .htaccess you need to add the rules on the .conf files for de nginx server.

Or the super easy way, change to a regular apache server. 

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

Did somebody find another solution here?

I have the same problem now in Prestashop 1.7.5.1. I did the following things, but still not working:

1. I disabled the Friendly URL -> the images are showing -> enabled back the Friendly URL -> the images NOT showing.

2. Put the following .htaccess in the folder "img":

<IfModule mod_php5.c>
    php_flag engine off
</IfModule>

# Apache 2.2
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
    <Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm|ico)$">
        Allow from all
    </Files>
</IfModule>

# Apache 2.4
<IfModule mod_authz_core.c>
    Require all denied
    <Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm|ico)$">
        Require all granted
    </Files>
</IfModule>

 

Thank you,

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
On 4/6/2019 at 11:02 AM, bzero said:

i got the same issue, removed the .htaccess doesn't help.

anyone has other idea how to make it works.

Thank you.

If you are in a Nginx server the .htaccess is not going to work

Link to comment
Share on other sites

  • 3 months later...
  • 10 months later...

hey am also facing same problem its my .conf file any one help me to fix....

 

Quote

proxy_cache_path /var/nginx/cache/smithikakart levels=1 keys_zone=smithikakart:128m inactive=1h;

limit_req_zone $binary_remote_addr zone=smithikakart_smithikakart_in:1m rate=15r/m;

server {

    listen xxxxxxxxx:80 ;

    server_name smithikakart.in www.smithikakart.in mail.smithikakart.in;


    root /home/smithikakart/public_html;

    gzip on;
    etag on;
    gzip_proxied any;
    gzip_comp_level 3;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    gzip_vary on;

    brotli_static on;
    brotli on;
    brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    brotli_comp_level 4;

    proxy_bind xxxxxxxxxxxxx;

    proxy_cache smithikakart;
    proxy_ignore_headers Cache-Control Expires ;
    proxy_cache_valid 200 14400s;
    proxy_cache_valid 406 0s;
    proxy_cache_valid 404 10s;
    proxy_cache_valid 500 0;
    proxy_cache_use_stale updating error timeout http_502 http_503 http_504;
    proxy_cache_lock on;
    proxy_cache_key "$scheme$request_method$host$request_uri";
    proxy_cache_convert_head on;

    include errors.conf;


    rewrite ^/cpanel/?$ https://$hostname:2083/ permanent;
    rewrite ^/whm/?$ https://$hostname:2087/ permanent;
    rewrite ^/webmail/?$ https://$hostname:2096/ permanent;


    tcp_nodelay off;

    if ($request_uri ~ "^(.*/wp-admin|.*/administrator|/admin|/user|.*/wp-cron\.php|/.*login\.php|/opcache\.php|.*/xmlrpc\.php|.*/phpinfo\.php|/basket.*|/cart.*|/my-account.*|/checkout.*|/addons.*)") {
        set $cache_bypass 1;
    }


    location ~* \.(ico|jpe?g|gif|png|bmp|svg|tiff|exe|dmg|zip|rar|7z|docx?|xlsx?|js|css|less|sass|scss|ttf|woff2?|mp3|mp4|mkv|avi|mov|mpe?g|aac|wav|flac)$ {
        expires 7d;
        add_header Cache-Control "public, must-revalidate";
        add_header X-Proxy-Cache "STATIC/TYPE";
    }

    location ~ "^(/wp-content/uploads)" {
        expires 7d;
        add_header Cache-Control "public, must-revalidate";
        add_header X-Proxy-Cache "STATIC/PATH";
    }

    if ($http_cookie ~ "(_logged_in_|items_in_cart|jsid)") {
        set $cache_bypass 1;
    }

    location ~ "^(/.*login\.php|.*/xmlrpc\.php|.*/wp-cron\.php)" {
        limit_req_status 429;
        limit_req zone=smithikakart_smithikakart_in burst=8 nodelay;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_no_cache 1;
        proxy_cache_bypass 1;
        add_header X-Proxy-Cache $upstream_cache_status;


        proxy_pass http://xxxxxxx:8080;
    }


    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_no_cache $cache_bypass;
        proxy_cache_bypass $cache_bypass;
        add_header X-Proxy-Cache $upstream_cache_status;


        proxy_pass http://xxxxxxxxxxx:8080;
    }

    location ~ ^/purge(/.*) {
        proxy_cache_purge smithikakart "$scheme$request_method$host$1";
    }
}

server {

    listen xxxxxxxx:80;

    server_name cpanel.smithikakart.in;


    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxx;

        proxy_pass http://xxxxxxxxxxxx/;
    }
}

server {

    listen xxxxxxxxxxxxxx;

    server_name webmail.smithikakart.in;


    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxxxxx;

        proxy_pass http://xxxxxxxxxx:8080/;
    }
}
 server {

    listen xxxxxxxxxxxx:80;

    server_name whm.smithikakart.in;


    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxxxxx;

        proxy_pass http://xxxxxxxxxxx:2086/;
    }
}

server {

    listen xxxxxxx:80;

    server_name webdisk.smithikakart.in;


    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxx;

        proxy_pass xxxxxxxxxxxx/;
    }
}


server {

    listen xxxxxxxxxx:443 ssl http2 ;

    server_name smithikakart.in www.smithikakart.in mail.smithikakart.in;

    ssl_certificate /var/nginx/certs/smithikakart-in.pem;
    ssl_certificate_key /var/nginx/certs/smithikakart-in.key;


    root /home/smithikakart/public_html;

    gzip on;
    etag on;
    gzip_proxied any;
    gzip_comp_level 3;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    gzip_vary on;

    brotli_static on;
    brotli on;
    brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    brotli_comp_level 4;

    proxy_bind xxxxxxxxxxx;

    proxy_cache smithikakart;
    proxy_ignore_headers Cache-Control Expires ;
    proxy_cache_valid 200 14400s;
    proxy_cache_valid 406 0s;
    proxy_cache_valid 404 10s;
    proxy_cache_valid 500 0;
    proxy_cache_use_stale updating error timeout http_502 http_503 http_504;
    proxy_cache_lock on;
    proxy_cache_key "$scheme$request_method$host$request_uri";
    proxy_cache_convert_head on;

    include errors.conf;


    rewrite ^/cpanel/?$ https://$hostname:2083/ permanent;
    rewrite ^/whm/?$ https://$hostname:2087/ permanent;
    rewrite ^/webmail/?$ https://$hostname:2096/ permanent;


    tcp_nodelay off;

    if ($request_uri ~ "^(.*/wp-admin|.*/administrator|/admin|/user|.*/wp-cron\.php|/.*login\.php|/opcache\.php|.*/xmlrpc\.php|.*/phpinfo\.php|/basket.*|/cart.*|/my-account.*|/checkout.*|/addons.*)") {
        set $cache_bypass 1;
    }


    location ~* \.(ico|jpe?g|gif|png|bmp|svg|tiff|exe|dmg|zip|rar|7z|docx?|xlsx?|js|css|less|sass|scss|ttf|woff2?|mp3|mp4|mkv|avi|mov|mpe?g|aac|wav|flac)$ {
        expires 7d;
        add_header Cache-Control "public, must-revalidate";
        add_header X-Proxy-Cache "STATIC/TYPE";
    }

    location ~ "^(/wp-content/uploads)" {
        expires 7d;
        add_header Cache-Control "public, must-revalidate";
        add_header X-Proxy-Cache "STATIC/PATH";
    }

    if ($http_cookie ~ "(_logged_in_|items_in_cart|jsid)") {
        set $cache_bypass 1;
    }

    location ~ "^(/.*login\.php|.*/xmlrpc\.php|.*/wp-cron\.php)" {
        limit_req_status 429;
        limit_req zone=smithikakart_smithikakart_in burst=8 nodelay;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_no_cache 1;
        proxy_cache_bypass 1;
        add_header X-Proxy-Cache $upstream_cache_status;


        proxy_ssl_verify off;
        proxy_ssl_session_reuse off;
        proxy_ssl_name $http_host;
        proxy_ssl_server_name on;
        proxy_pass https://xxxxxxxxxxx:8443;
    }


    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_no_cache $cache_bypass;
        proxy_cache_bypass $cache_bypass;
        add_header X-Proxy-Cache $upstream_cache_status;


        proxy_ssl_verify off;
        proxy_ssl_session_reuse off;
        proxy_ssl_name $http_host;
        proxy_ssl_server_name on;
        proxy_pass https://xxxxxxxxxxxx;
    }

    location ~ ^/purge(/.*) {
        proxy_cache_purge smithikakart "$scheme$request_method$host$1";
    }
}

server {

    listen xxxxxxxxxx:443 ssl http2;

    server_name cpanel.smithikakart.in;

    ssl_certificate /var/nginx/certs/smithikakart-in.pem;
    ssl_certificate_key /var/nginx/certs/smithikakart-in.key;

    ssl_prefer_server_ciphers on;
    ssl_buffer_size 8k;

    ssl_protocols  TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256';
    ssl_ecdh_curve secp384r1;
    ssl_dhparam /var/nginx/dhparams.pem;

    http2_idle_timeout 5m;

    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxx;

        proxy_ssl_verify off;
        proxy_ssl_session_reuse off;
        proxy_ssl_name $http_host;
        proxy_ssl_server_name on;
        proxy_set_header X-HTTPS 1;
        proxy_pass http://xxxxxxxxxxx:2082/;
    }
}

server {

    listen xxxxxxxxxxxx:443 ssl http2;

    server_name webmail.smithikakart.in;

    ssl_certificate /var/nginx/certs/smithikakart-in.pem;
    ssl_certificate_key /var/nginx/certs/smithikakart-in.key;

    ssl_prefer_server_ciphers on;
    ssl_buffer_size 8k;

    ssl_protocols  TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256';
    ssl_ecdh_curve secp384r1;
    ssl_dhparam /var/nginx/dhparams.pem;

    http2_idle_timeout 5m;

    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxxxxxxx;

        proxy_ssl_verify off;
        proxy_ssl_session_reuse off;
        proxy_ssl_name $http_host;
        proxy_ssl_server_name on;
        proxy_set_header X-HTTPS 1;
        proxy_pass http://xxxxxxxxxxxx:8080/;
    }
}
 server {

    listen xxxxxxxxx:443 ssl http2;

    server_name whm.smithikakart.in;

    ssl_certificate /var/nginx/certs/smithikakart-in.pem;
    ssl_certificate_key /var/nginx/certs/smithikakart-in.key;

    ssl_prefer_server_ciphers on;
    ssl_buffer_size 8k;

    ssl_protocols  TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256';
    ssl_ecdh_curve secp384r1;
    ssl_dhparam /var/nginx/dhparams.pem;

    http2_idle_timeout 5m;

    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxxx;

        proxy_ssl_verify off;
        proxy_ssl_session_reuse off;
        proxy_ssl_name $http_host;
        proxy_ssl_server_name on;
        proxy_set_header X-HTTPS 1;
        proxy_pass http://xxxxxxxxxxx:2086/;
    }
}

server {

    listen xxxxxxxxxxxxx:443 ssl http2;

    server_name webdisk.smithikakart.in;

    ssl_certificate /var/nginx/certs/smithikakart-in.pem;
    ssl_certificate_key /var/nginx/certs/smithikakart-in.key;

    ssl_prefer_server_ciphers on;
    ssl_buffer_size 8k;

    ssl_protocols  TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256';
    ssl_ecdh_curve secp384r1;
    ssl_dhparam /var/nginx/dhparams.pem;

    http2_idle_timeout 5m;

    location ~ "^/(\.well-known\/|[A-Fa-f0-9]{32}.txt$)" {
        root /home/smithikakart/public_html;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_bind xxxxxxxxxxxxx;

        proxy_ssl_verify off;
        proxy_ssl_session_reuse off;
        proxy_ssl_name $http_host;
        proxy_ssl_server_name on;
        proxy_set_header X-HTTPS 1;
        proxy_pass http://xxxxxxxxxxxx:2077/;
    }
}
 

 

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

  • 2 months later...
  • 9 months later...
On 7/26/2020 at 1:18 PM, Smithikakart said:

Inmotion hosting supporter Paul S fixed my issue...

hi Smithi

do you use inmotion hosting, did you solve the issue ??

cause i have the same issue and also i am on shared hosting on INMOTION

please help 

thank you

Link to comment
Share on other sites

57 minutes ago, karimaotmari said:

hi Smithi

do you use inmotion hosting, did you solve the issue ??

cause i have the same issue and also i am on shared hosting on INMOTION

please help 

thank you

If its your hosting issue, contact INMOTION support.

Link to comment
Share on other sites

47 minutes ago, karimaotmari said:

i did contact them, they dont wanna listen all they keep saying is that its a CMS issue from my side and thats it (hire a web developer they said) 

You did try with disabling and enabling friendly url?

Can you post the website link?

Link to comment
Share on other sites

12 hours ago, karimaotmari said:

hi Smithi

do you use inmotion hosting, did you solve the issue ??

cause i have the same issue and also i am on shared hosting on INMOTION

please help 

thank you

it was VPS nginx cache issue now if u face this issue in shared hosting server means, make sure u have the cache control in cpanel options if u have that kindly share that screenshot let u know the exact option to disable to fix this nginx image issue...

Link to comment
Share on other sites

1 hour ago, ComGrafPL said:

You did try with disabling and enabling friendly url?

Can you post the website link?

hi guys thank you for your help, 

found the solution actually, this is it

i use an INMOTION shared hosting plan 

Prestashop 1.7.7.5

Nginx/Apache server combination 

in this type of installation you have an option to skip Apache processing to serve static content (like images) quickly 

this option is called: Accelerate static content.

skipping Apache means skipping the rewrite rules for friendly url as well resulting in a not found path (404)

Disabling this option make product images appears normally.

to disable this option go to your CPANEL -> Cache Manager -> Chose related domain name -> Options -> find (Accelerate static content) -> Disable

Link to comment
Share on other sites

1 hour ago, Smithikakart said:

it was VPS nginx cache issue now if u face this issue in shared hosting server means, make sure u have the cache control in cpanel options if u have that kindly share that screenshot let u know the exact option to disable to fix this nginx image issue...

Yes smithi i guess i found the Damn option than no one in inmotion hosting seems to know about

 

  • Like 1
Link to comment
Share on other sites

yes am using inmotion still looks like they are the better option but for root level u have to spend some more money even for root level option also they are too good with their support level if u r not get ur proper response for ur query better close that session and try to communicate with some other good knowledged guy they will teach u more... and for cloudflare yes still am using...

Link to comment
Share on other sites

  • 3 weeks later...
On 7/11/2021 at 10:34 AM, karimaotmari said:

hi guys thank you for your help, 

found the solution actually, this is it

i use an INMOTION shared hosting plan 

Prestashop 1.7.7.5

Nginx/Apache server combination 

in this type of installation you have an option to skip Apache processing to serve static content (like images) quickly 

this option is called: Accelerate static content.

skipping Apache means skipping the rewrite rules for friendly url as well resulting in a not found path (404)

Disabling this option make product images appears normally.

to disable this option go to your CPANEL -> Cache Manager -> Chose related domain name -> Options -> find (Accelerate static content) -> Disable

Thank you so much for the info, this help me and works. I had been researching this problem for several months (contacting with InMotion support, web developers, etc) and could not find a solution. Thank you very much again, you have saved my life 🥰😊

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

it took  a ruined week end to find this, no one at inmotion knows about it. it seems that they are focusing on wordpress only (as someone told me) but there you go am glad it helped you. this why its so important to post a solution if you find one by yourself. good luck.

Link to comment
Share on other sites

  • 2 years 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...