If this is your first visit, check our documentation. To post, register or login.
Forums / Business Issues / Search Engines / Turned on SSL to always, but landing pages not cooperating

Turned on SSL to always, but landing pages not cooperating

Started by bowerstech on 13 Mar 2018, 1:14 PM · Views: 2,043

Results 1 to 14 of 14
13 Mar 2018, 1:14 PM
#1
bowerstech avatar

bowerstech

New Zenner

Join Date:
Mar 2010
Posts:
83
Plugin Contributions:
0

Turned on SSL to always, but landing pages not cooperating

In preparation for Google requiring SSL on all pages I decided to turn on SSL for http in the /includes/configure.php file:

// Define the webserver and path parameters
  // HTTP_SERVER is your Main webserver: eg-http://www.your_domain.com
  // HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com
  define('HTTP_SERVER', 'https://dollargraphicsdepot.com');
  define('HTTPS_SERVER', 'https://dollargraphicsdepot.com');

  // Use secure webserver for checkout procedure?
  define('ENABLE_SSL', 'true');

The problem I am seeing is that SSL is not automatically enabled on the first page you visit on the site. If you type it in the address bar, or click on a link... the very first page is http not https. As soon as you click on any link on the website, you are then switched to SSL.

http://dollargraphicsdepot.com

The problem occurs with all pages, not just the home page. I have cleared caches, used different browsers, and even different computers and have seen the same behavior.

Running ZC 1.51, PHP 5.4.45, MySQL 5.5.58-cll

It's probably a simple setting, but I cannot for the life of me figure this one out. :frusty:

13 Mar 2018, 1:48 PM
#2
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Turned on SSL to always, but landing pages not cooperating

There are several things you can do, to redirect nonssl to ssl by default.

  1. Some hosts have a switch somewhere in their control panel to allow all nonssl to be redirected to ssl.
  2. add/edit a .htaccess file in your root folder.
    Add this to the top```
    RewriteEngine ON
    RewriteCond %{HTTP_HOST} ^[URL="http://dollargraphicsdepot.com/"]dollargraphicsdepot.com[/URL] [NC]RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://[URL="http://dollargraphicsdepot.com/"]dollargraphicsdepot.com[/URL]/$1 [R,L]
13 Mar 2018, 1:56 PM
#3
bowerstech avatar

bowerstech

New Zenner

Join Date:
Mar 2010
Posts:
83
Plugin Contributions:
0

Re: Turned on SSL to always, but landing pages not cooperating

Thanks so much! It looks like I have a rewrite in there already doing something else.

RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?dollargraphicsdepot\.com)$ [NC]
RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]

Should I add a second entry below this?

13 Mar 2018, 3:53 PM
#4
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Turned on SSL to always, but landing pages not cooperating

bowerstech:

Thanks so much! It looks like I have a rewrite in there already doing something else.

RewriteCond %{HTTP_HOST} ^www.(([a-z0-9_]+.)?dollargraphicsdepot.com)$ [NC]
RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]

> 
> Should I add a second entry below this?
Yes, I think so. I am not a .htacces expert, google is my friend in this :smile:

Your first line tells the browser to go from <https://www.yourdomain.com> to yourdomain.com
the second i think tells search engines that the rewrite is permanent.
14 Mar 2018, 1:40 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Turned on SSL to always, but landing pages not cooperating

A couple of things. First of all does the site use sub-domains such as faq.dollargraphics.com to redirect/access say a frequently asked question section of the site? If so, does the ssl support that/those sub-domain(s) (wildcard type ssl)? If the answer to the second is yes, do you want all of your sub-domains to be served with ssl all of the time?

Ideally, any redirect that is performed would send the visitor to the end location in as few jumps/redirects as possible. Currently the RewriteCond checks to see if there is a match (begins with www. and has a sub-domain or no sub-domain to the main domain) then if that condition matches it redirects to the provided domain/sub-domain without the www, but to the http: version (which means if you wanted all traffic to go to the https: version of the page that yet another rule is needed to accomplish this and a second redirect will occur.) If however, all traffic is to go to https: then the existing redirect should be modified to goto https: and still a second redirect should be included where attempting to access the site even without the www. prefix would redirect to the https: version of this site or in the case of using sub-domains to the https: version of that/those sites.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

15 Mar 2018, 12:14 AM
#6
bowerstech avatar

bowerstech

New Zenner

Join Date:
Mar 2010
Posts:
83
Plugin Contributions:
0

Re: Turned on SSL to always, but landing pages not cooperating

Thanks everyone, this fixed the entry page so that everything is now SSL as soon as you hit it.

Follow up question: How do you force all content to be delivered via SSL? I am getting the "Your Connection To The Site Is Site is Not Fully Secure"? I saw the notes about finding every http reference but that is next to impossible. WordPress has a plugin that does this, is there some easy way to do it in ZC?

15 Mar 2018, 5:03 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Turned on SSL to always, but landing pages not cooperating

From looking at the source code of your main page, the issue is that there are several hard-coded entries either in php files or in the database where src="http: is entered. These need to be found and changed to src="https:

Identification of the file(s) in which this is the case can be done via the admin screen->tools->developers toolkit and searching for the text string: src="http:

Find all of the files and then using ftp, change the portion reading http: to https: if instead these entries are say in the database in known areas such as products_description then a sql statement could be applied to each grouping to convert the same text wherever it may be found.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

15 Mar 2018, 5:38 AM
#8
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Turned on SSL to always, but landing pages not cooperating

mc12345678:

From looking at the source code of your main page, the issue is that there are several hard-coded entries either in php files or in the database where src="http: is entered. These need to be found and changed to src="https:

Identification of the file(s) in which this is the case can be done via the admin screen->tools->developers toolkit and searching for the text string: src="http:

Find all of the files and then using ftp, change the portion reading http: to https: if instead these entries are say in the database in known areas such as products_description then a sql statement could be applied to each grouping to convert the same text wherever it may be found.

i think you are better served by changing everything from:

src="http://

to

src="//

the same can be done to:

src="https://

to

src="//

in addition, while .htaccess works, you can review the code here as how we look to change to all ssl in the future:

https://github.com/zencart/zencart/pull/1525

the solution provided there eliminates the need to any .htaccess rules.

in addition, while you think it may immediately be https when you hit it, that is actually incorrect. you get to the non-https site, and you are then redirected to https. it is a difference from what you describe.

in addition, you are providing a 302 on the non-https page redirect when you should provide a 301. the htaccess rule above has it listed as a 301, so i'm not sure where your 302 comes from.

good luck.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

15 Mar 2018, 12:18 PM
#9
bowerstech avatar

bowerstech

New Zenner

Join Date:
Mar 2010
Posts:
83
Plugin Contributions:
0

Re: Turned on SSL to always, but landing pages not cooperating

Great thanks everyone. Sounds like I have a lot of work ahead of me

15 Mar 2018, 12:30 PM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Turned on SSL to always, but landing pages not cooperating

carlwhat:

i think you are better served by changing everything from:

src="http://

to

src="//

the same can be done to:

src="https://

to

src="//
This is unnecessary for this site as the entire site is being served as https. As discussed several times elsewhere within the forum, not identifying the protocol to be used (http, https, ftp, c:, etc...) can lead to undesirable operation. For sites that operate in a mixed environment, I total agree and advocate such a solution with the added warning of how the software may respond in other environments and is a necessary evil when a site is operated as ZC is designed. Which is to permit switching between http and https to serve the pages using https when such information is to use the SSL certificate.

carlwhat:

in addition, while .htaccess works, you can review the code here as how we look to change to all ssl in the future:

https://github.com/zencart/zencart/pull/1525

the solution provided there eliminates the need to any .htaccess rules.

in addition, while you think it may immediately be https when you hit it, that is actually incorrect. you get to the non-https site, and you are then redirected to https. it is a difference from what you describe.

in addition, you are providing a 302 on the non-https page redirect when you should provide a 301. the htaccess rule above has it listed as a 301, so i'm not sure where your 302 comes from.

good luck.

This is misleading as the code change does not eliminate the need for ANY .htaccess rule, it is intended to eliminate the need of an .htaccess rule for the purpose of redirecting a site to an https address when the site is to be provided fully using https. As you know and have advised to others, there are other .htaccess rules that may still need to be applied to support other intended/desired operation (hardening, restriction of access to the site or designated locations, etc...).

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

15 Mar 2018, 12:33 PM
#11
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Turned on SSL to always, but landing pages not cooperating

bowerstech:

Thanks everyone, this fixed the entry page so that everything is now SSL as soon as you hit it.

Follow up question: How do you force all content to be delivered via SSL? I am getting the "Your Connection To The Site Is Site is Not Fully Secure"? I saw the notes about finding every http reference but that is next to impossible. WordPress has a plugin that does this, is there some easy way to do it in ZC?
I'd developed such a script for a client who was moving to https-all-the-time. I'll get that packaged up for "general" use.

15 Mar 2018, 8:05 PM
#12
bowerstech avatar

bowerstech

New Zenner

Join Date:
Mar 2010
Posts:
83
Plugin Contributions:
0

Re: Turned on SSL to always, but landing pages not cooperating

lat9:

I'd developed such a script for a client who was moving to https-all-the-time. I'll get that packaged up for "general" use.

Thanks that would be awesome! I just tried using the developers toolkit and keep getting " Error: No Configuration Key or Text was entered to search for ... Search was terminated" no matter what I put into the box(s).

18 Mar 2018, 3:39 PM
#13
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Turned on SSL to always, but landing pages not cooperating

mc12345678:

This is misleading as the code change does not eliminate the need for ANY .htaccess rule, it is intended to eliminate the need of an .htaccess rule for the purpose of redirecting a site to an https address when the site is to be provided fully using https. As you know and have advised to others, there are other .htaccess rules that may still need to be applied to support other intended/desired operation (hardening, restriction of access to the site or designated locations, etc...).

wow.

i find it hard to imagine someone looking for help on, for example, a URL rewrite plugin that stumbled across this thread, implemented the whole site SSL pr i referenced above, and then came to the conclusion that they no longer needed any .htaccess rules. (assuming of course that their URL rewrite plugin made use of .htaccess rules.)

i guess those kind of store owners exist; although i have yet to see any posts from them and, in turn, offer to help them.

but allow me to be clear, when i stated there is no need for any .htaccess rules, it is solely related to the problem that the OP was having.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.