Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 312
Joined: 01 Mar 2011, 11:13

Strange behaviour using https

02 Feb 2017, 07:22

Hello Karl, recently I started using https and everything work fine but I've noticed one strange thing. Since in my forum are displayed some images from the gallery, usually when someone clicked on the thumbs he landed on that specific gallery with an url like this one

http://gallery.kog.it/20112015/2013/301113

that unfortunately doesn't have the 's' but I'm searching where to put it.

Problem is that if you go to that url you get an error but if you go to the same url with https, it work

https://gallery.kog.it/20112015/2013/301113

Can you please tell me how to fix this problem? Thanks!
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 312
Joined: 01 Mar 2011, 11:13

Re: Strange behaviour using https

02 Feb 2017, 07:25

Update, found where to put https so now it's working but I'm asking myself how to fix the url problem without https. If someone linked to my gallery without https he gets an error now but basically in htaccess I've put this
Code
RewriteEngine on

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://gallery.kog.it//$1 [R=301,L]
so it should work. What I'm doing wrong?
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14452
Joined: 30 Sep 2006, 03:37

Re: Strange behaviour using https

02 Feb 2017, 09:30

Your redirect doesn't seem to be working correctly. In fact, the non-SSL version doesn't even seem to be UP now, and therefore, it cannot redirect either ... When I go to http://gallery.kog.it/20112015/2013/301113, I see this:
Image

Was it working before? This is something your server is doing now, as it seems the non-ssl version (port:80), does not seem to even point to the same location as your SSL website.
Update, found where to put https so now it's working but I'm asking myself how to fix the url problem without https.
I am not quite sure what "is working" now ... I don't see why you have double-slashes// after kog.it//. The below is the suggested implementation from Html5 Boilerplate, who create "best standards" for default web documents:
Code
# ----------------------------------------------------------------------
# | Forcing `https://`                                               |
# ----------------------------------------------------------------------

# Redirect from the `http://` to the `https://` version of the URL.
# https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

# <IfModule mod_rewrite.c>
#    RewriteEngine On
#    RewriteCond %{HTTPS} !=on
#    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# </IfModule>
You should perhaps try the exact code above, including the dynamic value %{HTTP_HOST}. All this rule does, is check if the URL is running from http://*** ... If so, just keep the same link, but change it to https://***. In your case, either the server is redirecting non-SSL traffic somewhere else now, or your .htaccess code is incorrect.
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 312
Joined: 01 Mar 2011, 11:13

Re: Strange behaviour using https

03 Feb 2017, 05:56

Thanks Karl, with your code the http link works perfectly BUT doesn't switch to https. It remains on http. I've tried the same url

http://gallery.kog.it/20112015/2013/301113

that now works correctly as you may see, but it doesn't switch to https, it remain on http...
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 312
Joined: 01 Mar 2011, 11:13

Re: Strange behaviour using https

03 Feb 2017, 06:01

Checked the site you indicated and there was a little error in the code. Tried this and now it's working
Code
# ----------------------------------------------------------------------
# | Forcing `https://`                                               |
# ----------------------------------------------------------------------

# Redirect from the `http://` to the `https://` version of the URL.
# https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

 <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
</IfModule>
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14452
Joined: 30 Sep 2006, 03:37

Re: Strange behaviour using https

03 Feb 2017, 08:56

ok nice!  :thumbsup: