Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2019-09-12 07:52:57
- kimass
- New Member
- Registered: 2019-09-12
- Posts: 8
Site images not showing up with https
My web site stopped showing some images after switching from http to https. Service provider sent me an email that I have to fix .htaccess file to show the images. Here is a part of code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#RewriteBase /relative/web/path/
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?example.com/.*$ [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule .(gif|jpg|png)$ – [F]
Any idea?
Last edited by kimass (2019-09-12 10:50:21)
Offline
Re: Site images not showing up with https
Hi, welcome to the forum.
Normally, image URL generated via txp tags should use https, but hardcoded (via Textile or HTML) images URL need to be redirected to https.
The solution depends on your server configuration. Try googling for htaccess redirect http https to check if something works for you.
Offline
#3 2019-09-12 12:30:10
- kimass
- New Member
- Registered: 2019-09-12
- Posts: 8
Re: Site images not showing up with https
Hi, thank you.
I’ve been trying since yesterday, with no success.
Server is Apache, I have c panel, and few wordpress websites at the same provider. But this is my first textpattern and I wouldn’t like to make a mess.
Offline
Re: Site images not showing up with https
Hi kimass
and welcome to txp
Did you try the htaccess code here?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#5 2019-09-12 14:41:20
- kimass
- New Member
- Registered: 2019-09-12
- Posts: 8
Re: Site images not showing up with https
Hi colak,
thanks!
do you mean this:
——————————————————————————————-
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
———————————————————————————————
And where exactly to put it?
Offline
Re: Site images not showing up with https
kimass wrote #319275:
Hi colak,
thanks!do you mean this:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
And where exactly to put it?
That is what I meant:) You can copy paste it on top of your htaccess in the root directory of your txp site. If your server misbehaves just delete it and we’ll try to find another snippet for you.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#7 2019-09-12 18:23:01
- kimass
- New Member
- Registered: 2019-09-12
- Posts: 8
Re: Site images not showing up with https
I’ve put it on the top of the .htaccess but nothing.
Offline
Re: Site images not showing up with https
I always prefer conditional links, not absolute:
/my-webpage or "link":my-webpage — internal, and
//domain.tld/link — external links.
Warning: this method is not suitable for linking from own encoded to external plain URLs (https to http).
Offline
Re: Site images not showing up with https
Hi kimass,
could we have the url of your site in order to experience the behaviour your describe?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Site images not showing up with https
Also check out this post as we need to define the https protocol in the config.php file
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#11 2019-09-13 06:47:26
- kimass
- New Member
- Registered: 2019-09-12
- Posts: 8
Re: Site images not showing up with https
Url
https://www.servisracunara.co/
Thank you
Offline
Re: Site images not showing up with https
I see all the images in your site. Can you point me to a page where the images do not load?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Site images not showing up with https
You should probably replace http:// with https?:// if this rule is enabled:
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?example.com/.*$ [NC]
In my tests, regular images are loaded in FF but not logos. In Edge all image requests with referrer get txt 404 page in reply.
Edit: disabling referer in FF fixes the problem, fwiw.
Offline
Re: Site images not showing up with https
etc wrote #319284:
In my tests, regular images are loaded in FF but not logos.
Same in Chrome on Android.
Offline
Re: Site images not showing up with https
I see! Basically, txp behaves OK but images outside the db do not!
There are two options there. One would be to upload those images in the txp db and call them from there. Another one would be to link to those images directly using a non secure (http) connection, which is the recommended way of calling images.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline