Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#2 2019-09-12 12:03:22

etc
Developer
Registered: 2010-11-11
Posts: 3,207
Website

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.


etc_[ query | search | pagination | date | tree | cache ]

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

#4 2019-09-12 12:49:32

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

Re: Site images not showing up with https

Hi kimass
and welcome to txp
Did you try the htaccess code here?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

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

#6 2019-09-12 17:40:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

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.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

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

#8 2019-09-12 18:49:55

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 178
Website

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

#9 2019-09-13 04:34:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

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.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#10 2019-09-13 06:42:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

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.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

Board footer

Powered by FluxBB