Hello Team,
I have a website in Joomla 3.9.5 with Virtuemart 3.4.2 and I am getting issue with the SSL warning "Loading mixed (insecure) display content" for all the images loading on website and when I am checking the URL for all the images then all are of having image path with "http://domain.com/...." even if I am trying to access the domain with https. Also I have enabled the Force SSL to ALL in admin and also in thaccess added the code for https but still the images url is having http path.
Can anyone please let me know why the image path is changing and keeping http url path?
Also why the image path is adding website URL in src tag and not starting from /images/ folder??
Please provide feedback.
Thanks in advanced.
We cannot guess as to what you are doing.
Please show your screen shot of the image in the product admin.
Hello There,
Thank you for replying.
Please see the attached screenshot of the home page of the website. Please provide your feedback/suggestion.
Thanks in advanced
Ok, where do you load this image in the template? This might be template dependant. Looks lie a custom template.
Jörgen
Hi Jorgen,
Thank you for replying.
We have purchased the template and used the same. Please see the below URL for template.
https://themeforest.net/item/flatastic-responsive-multipurpose-virtuemart-theme/7084257
And also all the images url at our website is starts with "http://" and that's why the page loading request is increasing.
You can see the same at our website with the below URL.
https://www.uniforms.com.au/
Please provide your suggestion.
Thanks in advanced.
Looks that You actually have a certificate installed, so far so good. You could try adding this to Your htaccess to rewrite the http requests. Is this code in Your root directory ?
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteRule (.*) https://www.%1/$1 [R=301,L]
I guess You should also check You template code and see if your template hardcodes http.
In your place I would ask your template supplier for advice.
Jörgen @ Kreativ Fotografi
Hi Jorgen,
We already have a below code in htaccess file.
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule ^(.*)$ https://www.uniforms.com.au/$1 [R=301,L]
And when I was commented my above code and replaced with your provided code then the website not loading any images because all image urls are staring from http:// and that's why all are not loading when your code was added in htaccess file.
Also checked and didn't found any hardcoded urls with http in template and other codes. And also our support term was expired with the template suppliers and that's why we will didn't getting any further supports from them.
Please help and provide your suggestions.
Thanks in advanced.
Have you try to clear the Joomla cache or any cache (from cloudflare for eg)?
It can be that the cache have the old links.
Verify that the images and joomla is set to use relatives URL and that you dont used by mistake http::// link for this images.
I checked the product details page and the URL are using SSL links, so it's certainly the cache used by your template or module in front page.
if u try to load the rendered e.g. http://www.uniforms.com.au/images/stories/virtuemart/product/resized/ZH245_Worn_2015__1551005340_800.jpg it is redirected to https://www.uniforms.com.au/images/stories/virtuemart/product/resized/ZH245_Worn_2015__1551005340_800.jpg
In a standard template the img is a relative path
check the code in the template sublayouts/products.php
what happens when u switch to Beez etc?
Hello Team,
I have tried to debug the image url and found that the url is generating from images folder like "/images/stories/virtuemart/product/resized/" but after loading full page at the browser it is then adding the main domain in front of link like "http://www.uniforms.com.au/images/stories/virtuemart/product/resized/" and due to the htaccess code the url again redirecting from http to https like "https://www.uniforms.com.au/images/stories/virtuemart/product/resized/".
I didn't got from where the image src is adding domain url in all the image src tags.
Answers to below:
Have you try to clear the Joomla cache or any cache (from cloudflare for eg)?
It can be that the cache have the old links.
Comment: Yes checked with clearing cache but still the same issue.
Verify that the images and joomla is set to use relatives URL and that you dont used by mistake http::// link for this images.
Comment: Where I can verify the images and Joomla is set to use relative URL in joomla website? Also I already checked the code for http:// and didn't found any links in code.
the url is created in the function displayMediaThumb() in administrator\components\com_virtuemart\helpers\mediahandler.php
Hi,
The image path from displayMediaThumb() is generating with https:// but other getFileUrlThumb() functions or if we are adding image path in src tag then the image path are not generating properly and it is showing http://.
Like:
$main_image_url1 = JURI::root().''.$product->images[0]->getFileUrlThumb();
$main_image_url1_p = JURI::root().''.$product->images[0]->getFileUrlThumb();
$image = '<img data-original="'.$main_image_url1 .'" src="'.$main_image_url1_p.'" title="'.$main_image_title.'" alt="'.$main_image_alt. '" class="lazy browseProductImage featuredProductImageFirst" id="Img_to_Js_'.$product->virtuemart_product_id.'"/>';
Then we are getting correct path in $main_image_url1_p like "/images/stories/...." but when we are adding same variable in $image then it is displaying full url with domain and http://.
I am very confused where it is changing.
Humm, is there some javascript that converts the paths for the images ? This indicates that some js involved:
id="Img_to_Js_'.$product->virtuemart_product_id.
Jörgen @ Kreativ Fotografi
You are correct Jorgen, It might be due to some js code which is adding domain url in image src, I need to check this.
Also this is the same case for logo of website also which is not having any id attribute like you can see below.
$logoimage = $logotype == 'image' ? $this->params->get('logoimage', 'templates/' . T3_TEMPLATE . '/images/logo.png') : '';
<img class="logo-img img-responsive" src="<?php echo JURI::base(true) . '/' . $logoimage ?>" alt="<?php echo strip_tags($sitename) ?>" />
And when I am debugging code <?php echo JURI::base(true) . '/' . $logoimage ?> then it is showing url from "/images/....".
Can anyone other facing this type of issue??
Try to change :
$main_image_url1 = JURI::root().''.$product->images[0]->getFileUrlThumb();
$main_image_url1_p = JURI::root().''.$product->images[0]->getFileUrlThumb();
to
$main_image_url1 = JURI::root(true).$product->images[0]->getFileUrlThumb();
$main_image_url1_p = JURI::root(true).$product->images[0]->getFileUrlThumb();
Note that you added ''. this render nothing, but the main change is tu use JURI::root(true) to use relative path
Hi Buddy...
Got the issue. Images URL was changing due to the plugin "XT Adaptive Images".
I have disabled a plugin and all the image URL's are now displaying fine.
Thanks for all help and suggestions.