prestol Posted July 21, 2019 Share Posted July 21, 2019 (edited) update 201907211703: SOLUTION Add the perserve host diretive on in the virutalhost configuration file root@vmhost: vi /etc/httpd/conf.d/vm1.conf ... ProxyPreserveHost On ... description of solution: host used the wrong ip address to access images because of missing directive for reverse proxy ------------ problem: images not showing when firenndly URL is turned ON (SEE IMAGE BELOW) IMAGES CAN BE SEEN FROM BACKOFFICE SETUP: This prestashop instance is on an internal network not accessible publicly inside a VM installed php modules: rh-php72 rh-php72-php rh-php72-php-xml rh-php72-php-gd rh-php72-php-intl rh-php72-php-zip rh-php72-php-common rh-pgp72-php-mbstring mod_rewrite is turned on in apache selinux is in permissive mode currently for debugging apache is the owner of /var/www/html FOR TESTING PURPIOSES ALL FILES IN /VAR/WWW/HTML IS CHMOD 777 (NOT RECOMMENDED FOR PRODUCTION) .htaaccess file is automatically generated when activating/deactivating friendly urls info_outline Configuration information This information must be provided when you report an issue on our bug tracker or forum. info_outline Server information Server information Linux #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 Server software version: Apache/2.4.6 (CentOS) PHP/7.2.10 PHP version: 7.2.10 Memory limit: 128M Max execution time: 30 Upload Max File size: 2M info_outline Database information MySQL version: 5.5.60-MariaDB MySQL server: 127.0.0.1 MySQL name: prestadb MySQL user: prestauser Tables prefix: presta_ MySQL engine: InnoDB MySQL driver: DbPDO info_outline Store information PrestaShop version: 1.7.6.0 Shop URL: http://vm1.com/ Shop path: /var/www/html Current theme in use: classic info_outline Mail configuration Mail method: You are using the PHP mail() function. info_outline Your information Your web browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 info_outline Check your configuration Required parameters: OK Optional parameters: OK I HAVE Deleted .htaccess file and turned friendly urls on (rm -rf /var/www/html/.htaaccess, BACKOFFICE > SHOP PARAMETERS > URL & SEO > FRIENDLY URLS > CHECKED ). The .htaccess file is regernerated with the following contents: # ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again # .htaccess automaticaly generated by PrestaShop e-commerce open-source solution # http://www.prestashop.com - http://www.prestashop.com/forums <IfModule mod_rewrite.c> <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> RewriteEngine on #Domain: vm1.com RewriteRule . - [E=REWRITEBASE:/] RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L] # Images RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^vm1.com$ RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L] # AlphaImageLoader for IE and fancybox RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L] # Dispatcher RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L] </IfModule> AddType application/vnd.ms-fontobject .eot AddType font/ttf .ttf AddType font/otf .otf AddType application/font-woff .woff AddType font/woff2 .woff2 <IfModule mod_headers.c> <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> </IfModule> #If rewrite mod isn't enabled ErrorDocument 404 /index.php?controller=404 # ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again SHOP PARAMETERS > SEARCH > Add missing products to the index & Re-build the entire index DESIGN > IMAGE SETTINGS > REGENERATE THUMBNAILS -------------------------------------------------------------------------------------------------------------- how can fix this? more images: debug image PHP FILE FRIENDLY URLS OFF FRIENDLY URLS ON Edited July 21, 2019 by prestol (see edit history) Link to comment Share on other sites More sharing options...
nobreferreira Posted August 8, 2019 Share Posted August 8, 2019 Hi, I have the same issue... Any clue on how to solve it? Cheers. Link to comment Share on other sites More sharing options...
Msaustral Posted December 24, 2021 Share Posted December 24, 2021 Hi for those that have not yet found a solution, one possible cause is that the product has not link_rewrite value. Go to the table ps_product_lang -> link_rewrite, it MUST have information, otherwise there is no information to build the image URL when URL friendly is active Hope it helps! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now