Post by ASG » Mon Aug 10, 2015 6:51 pm

I just had my OC1.5.6.4 site moved to SSL successfully.

However, there is a problem with the sitemap(domain.com/index.php?route=feed/google_sitemap) submitted to Google webmasters tools. The URLs in the sitemaps are all begining with http:// and not https. Is there something I can do so the Google sees my site at https instead of http only as evident in the sitemap?

Also, if I type www.mydomain.com, it is going to non-secure version. it is only after I type https://www.mydomain.com it goes to the secure address.

Following is what the .htaccess looks like:

Code: Select all

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^domain\.com[NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*) https://www.domain.com/$1 [L,R=301]

ASG
Active Member

Posts

Joined
Tue Sep 30, 2014 11:03 pm

Post by deepvision » Tue Aug 11, 2015 2:10 am

You can try to change http:// to https:// in the HTTP_SERVER.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by ASG » Tue Aug 11, 2015 4:07 pm

This is what I'm trying to do:

Code: Select all

http://www.domain.com  -> https://www.domain.com/
http://domain.com  -> https://www.domain.com  
https://www.domain.com/ -> https://www.domain.com/
However, the http://www.domain.com/ is still redirecting to the non-secure version for some odd reason.

Config files look like:

Code: Select all

// HTTP
define('HTTP_SERVER', 'https://www.domain.com/');
define('HTTP_IMAGE', 'https://www.domain.com/image');
// HTTPS
define('HTTPS_SERVER', 'https://www.domain.com/');
define('HTTPS_IMAGE', 'https://www.domain.com/image');
I've used several iterations of the code in .htaccess, nothing seems to work.

Code: Select all

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]
Any ideas what have I missed?

ASG
Active Member

Posts

Joined
Tue Sep 30, 2014 11:03 pm

Post by deepvision » Tue Aug 11, 2015 10:28 pm

the current conditions in the .htaccess file won't be triggered for http://www.domain.com/
only for http://domain.com/

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by YDA » Tue Aug 11, 2015 11:23 pm

Hi ASG,
First of all you have to set your config.php to this one: (I mean the root not the admin)
<?php
// HTTP
define('HTTP_SERVER', 'https://domainname.com/');
define('HTTP_CATALOG', 'https://domainname.com/image');

// HTTPS
define('HTTPS_SERVER', 'https://domainname.com/');
define('HTTPS_CATALOG', 'https://domainname.com/image');


// DIR


define('DIR_APPLICATION', '/var/www/vhosts/domainname.com/catalog/');
define('DIR_SYSTEM', '/var/www/vhosts/domainname.com/system/');
define('DIR_DATABASE', '/var/www/vhosts/domainname.com/system/database/');
define('DIR_LANGUAGE', '/var/www/vhosts/domainname.com/catalog/language/');
define('DIR_TEMPLATE', '/var/www/vhosts/domainname.com/catalog/view/theme/');
define('DIR_CONFIG', '/var/www/vhosts/domainname.com/system/config/');
define('DIR_IMAGE', '/var/www/vhosts/domainname.com/image/');
define('DIR_CACHE', '/var/www/vhosts/domainname.com/system/cache/');
define('DIR_DOWNLOAD', '/var/www/vhosts/domainname.com/download/');
define('DIR_LOGS', '/var/www/vhosts/domainname.com/system/logs/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', '');
define('DB_USERNAME', '');
define('DB_PASSWORD', '');
define('DB_DATABASE', '');
define('DB_PREFIX', 'oc_');
?>
Next step is your htacccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# If your installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Third step is to connect to your admin Opencart and :
Goto to system, settings, server and clic on "USE SSL"

If you also need to have your admin protected by ssl (it's more secure) you'll have to do this:

-1- Open admin/config.php and complete this with your domain name (with or without www)
<?php
// HTTP
define('HTTP_SERVER', 'https://domainname.com/admin/');
define('HTTP_CATALOG', 'https://domainname.com/');

// HTTPS
define('HTTPS_SERVER', 'https://domainname.com/admin/');
define('HTTPS_CATALOG', 'https://domainname.com/');
-2- HTACCESS
At the top of your HTACCESS
AddDefaultCharset ISO-8859-1
Order Deny,Allow
Deny from all
AuthUserFile /var/www/vhosts/DOMAINNAME.COM/admin/.htpasswd
AuthName "Administration Sécurisée"
AuthType Basic
require valid-user
Satisfy Any


Next you will have to create a file called HTPASSWD
In this file you will have to create an ID and a password


-3- HTACCESS
Copy this one wherever you want in your htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

If you need more assistance PM me I will try to help
Have a nice day
YDA
I use OC 1.5.5.1 and it works very fine

PS: I forgot to tell you that you also need to activate SEO revriting URL's in sytem, settings, server

Opencart 3.0.3.6
PHP 7.3.26 FPM served by NGINX 1.16.1.3
Linux Centos 7.9.2009 / Plesk 17.8.11
Dedicated Servers


User avatar
YDA
Newbie

Posts

Joined
Tue Jul 08, 2014 10:40 pm

Post by ASG » Wed Aug 19, 2015 7:17 pm

Nope. www.domain.com still redirecting to http version.

ASG
Active Member

Posts

Joined
Tue Sep 30, 2014 11:03 pm

Post by deepvision » Wed Aug 19, 2015 11:50 pm

Have you changed the .htaccess since my last message?
Because this code looks like to work only for http://domain.com/ requests, not http://www.domain.com/

Code: Select all

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]
You probably need to replace it with

Code: Select all

RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by YDA » Sat Aug 22, 2015 7:14 pm

Hi,
I suggest visiting one of the world specialist in apache and htaccess:
http://www.askapache.com/htaccess/ssl-e ... ccess.html
Have a nice day
YDA

Opencart 3.0.3.6
PHP 7.3.26 FPM served by NGINX 1.16.1.3
Linux Centos 7.9.2009 / Plesk 17.8.11
Dedicated Servers


User avatar
YDA
Newbie

Posts

Joined
Tue Jul 08, 2014 10:40 pm

Post by ASG » Wed Aug 26, 2015 1:23 pm

Deepvision's SSL extension did the trick for https everywhere.

There was a problem with http://domain.com still redirecting to non-http version, which I fixed using the 301 redirect in CPANEL by redirecting http://domain.com to https://www.domain.com

ASG
Active Member

Posts

Joined
Tue Sep 30, 2014 11:03 pm
Who is online

Users browsing this forum: Bing [Bot] and 109 guests