Post by johnr@oneohone.co.za » Sat Oct 17, 2015 2:23 am

Hi All

I know this has probably come up a few time already, but looking through the forums everything i try breaks my website. After I try and do any sort of redirect from http to https, and try then to go to my website I get a blank screen and then cant even get into my admin page.

I'm using opencart 2.0.3.1 and have a ssl certificate too. anyone had this issue before. I have tried the following:

config in root

<?php
// HTTP
define('HTTP_SERVER', 'https://www.oneohone.co.za/');
define('HTTP_IMAGE', 'https://www.oneohone.co.za/image/');
define('HTTP_ADMIN', 'https://www.oneohone.co.za/admin/');

// HTTPS
define('HTTPS_SERVER', 'https://www.oneohone.co.za/');
define('HTTPS_IMAGE', 'https://www.oneohone.co.za/image/');

Admin Config

<?php
// HTTP
define('HTTP_SERVER', 'https://www.oneohone.co.za/admin/');
define('HTTP_CATALOG', 'https://www.oneohone.co.za/');
define('HTTP_IMAGE', 'https://www.oneohone.co.za/image/');

// HTTPS
define('HTTPS_SERVER', 'https://www.oneohone.co.za/admin/');
define('HTTPS_CATALOG', 'https://www.oneohone.co.za/');
define('HTTPS_IMAGE', 'https://www.oneohone.co.za/image/');

In htaccess.txt

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^oneohone\.co\.za$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oneohone\.co\.za$
RewriteRule ^(.*) https\:\/\/oneohone\.co\.za\/$1 [R=301,L]

What am i doing wrong


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by uksitebuilder » Sat Oct 17, 2015 2:46 am

Configs look ok

try this in .htaccess

Code: Select all

RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^oneohone\.co\.za$
RewriteRule ^(.*) https://oneohone.co.za/$1 [R=301,L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by johnr@oneohone.co.za » Sat Oct 17, 2015 3:07 am

Thanks for the reply, tried that still get a blank page.

Below is my .htaccess.txt file

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>

#RewriteEngine On

# redirect to https for www
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www.oneohone.co.za$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# redirect to https for non-www
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^oneohone.com$
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

# to www for https
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} oneohone.co.za
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^oneohone\.co\.za$
RewriteRule ^(.*) https://oneohone.co.za/$1 [R=301,L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]

Root Config

<?php
// HTTP
define('HTTP_SERVER', 'https://www.oneohone.co.za/');
define('HTTP_IMAGE', 'https://www.oneohone.co.za/image/');

// HTTPS
define('HTTPS_SERVER', 'https://www.oneohone.co.za/');
define('HTTPS_IMAGE', 'https://www.oneohone.co.za/image/');

// DIR
define('DIR_APPLICATION', '/home/oneohon1/public_html/catalog/');
define('DIR_SYSTEM', '/home/oneohon1/public_html/system/');
define('DIR_LANGUAGE', '/home/oneohon1/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/oneohon1/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/oneohon1/public_html/system/config/');
define('DIR_IMAGE', '/home/oneohon1/public_html/image/');
define('DIR_CACHE', '/home/oneohon1/public_html/system/storage/cache/');
define('DIR_DOWNLOAD', '/home/oneohon1/public_html/system/storage/download/');
define('DIR_LOGS', '/home/oneohon1/public_html/system/storage/logs/');
define('DIR_MODIFICATION', '/home/oneohon1/public_html/system/storage/modification/');
define('DIR_UPLOAD', '/home/oneohon1/public_html/system/storage/upload/');

Admin Config

<?php
// HTTP
define('HTTP_SERVER', 'https://www.oneohone.co.za/admin/');
define('HTTP_CATALOG', 'https://www.oneohone.co.za/');

// HTTPS
define('HTTPS_SERVER', 'https://www.oneohone.co.za/admin/');
define('HTTPS_CATALOG', 'https://www.oneohone.co.za/');

// DIR
define('DIR_APPLICATION', '/home/oneohon1/public_html/admin/');
define('DIR_SYSTEM', '/home/oneohon1/public_html/system/');
define('DIR_LANGUAGE', '/home/oneohon1/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/oneohon1/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/oneohon1/public_html/system/config/');
define('DIR_IMAGE', '/home/oneohon1/public_html/image/');
define('DIR_CACHE', '/home/oneohon1/public_html/system/storage/cache/');
define('DIR_DOWNLOAD', '/home/oneohon1/public_html/system/storage/download/');
define('DIR_LOGS', '/home/oneohon1/public_html/system/storage/logs/');
define('DIR_MODIFICATION', '/home/oneohon1/public_html/system/storage/modification/');
define('DIR_UPLOAD', '/home/oneohon1/public_html/system/storage/upload/');
define('DIR_CATALOG', '/home/oneohon1/public_html/catalog/');


I have cleared my cache but still get a blank page, still cant get opencart default page and cant get into admin page.


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by uksitebuilder » Sat Oct 17, 2015 3:20 am

You have rewriterules in that file before your turn on the rewrite engine

You also say it's called .htaccess.txt - It should be renamed to .htaccess

Replace contents of that file with the following

Code: Select all

Options +FollowSymlinks
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>

RewriteEngine On

# redirect to http to https
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.oneohone.co.za/$1 [R=301,L]

# to www for https
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://www.oneohone.co.za/$1 [R=301,L]

# SEO URL Settings
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by johnr@oneohone.co.za » Sat Oct 17, 2015 3:24 am

Ok have done so but I'm still getting a blank page. Looks like redirect is working as when i type www.oneohone.co.za it redirects to https but page is still blank.


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by uksitebuilder » Sat Oct 17, 2015 3:29 am

OK, so problem lies elsewhere now.

Do you have any errors in your error log ?

Do you have vqmod installed ?

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by EvolveWebHosting » Sat Oct 17, 2015 3:34 am

Backup your .htaccess file and then

Wipe all of this out:

#RewriteEngine On

# redirect to https for www
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www.oneohone.co.za$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# redirect to https for non-www
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^oneohone.com$
RewriteRule ^(.*)$ https://www .%{HTTP_HOST}/$1 [R=301,L]

# to www for https
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} oneohone.co.za
RewriteRule ^(.*)$ https://www .%{HTTP_HOST}/$1 [R=301,L]

Then, replace this with the block of code with the block below it:

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^oneohone\.co\.za$
RewriteRule ^(.*) https://oneohone.co.za/$1 [R=301,L]


RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L]

This should work but I can't test it so make sure you have a backup of your .htaccess file first!

Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by johnr@oneohone.co.za » Sat Oct 17, 2015 3:42 am

EvolveWebHosting wrote:Backup your .htaccess file and then

Wipe all of this out:

#RewriteEngine On

# redirect to https for www
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www.oneohone.co.za$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# redirect to https for non-www
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^oneohone.com$
RewriteRule ^(.*)$ https://www .%{HTTP_HOST}/$1 [R=301,L]

# to www for https
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} oneohone.co.za
RewriteRule ^(.*)$ https://www .%{HTTP_HOST}/$1 [R=301,L]

Then, replace this with the block of code with the block below it:

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^oneohone\.co\.za$
RewriteRule ^(.*) https://oneohone.co.za/$1 [R=301,L]


RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L]

This should work but I can't test it so make sure you have a backup of your .htaccess file first!

Ok I have done the above. When I check my error logs I get


[16-Oct-2015 21:39:06 Africa/Johannesburg] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/timezonedb.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/timezonedb.so: cannot open shared object file: No such file or directory in Unknown on line 0
[16-Oct-2015 21:39:06 Africa/Johannesburg] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/imagick.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/imagick.so: cannot open shared object file: No such file or directory in Unknown on line 0
[16-Oct-2015 21:39:06 Africa/Johannesburg] PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'oneohon1_admins'@'localhost' (using password: YES) in /home/oneohon1/public_html/system/library/db/mysqli.php on line 7
[16-Oct-2015 21:39:06 Africa/Johannesburg] PHP Notice: Error: Could not make a database link (1045) Access denied for user 'oneohon1_admins'@'localhost' (using password: YES) in /home/oneohon1/public_html/system/library/db/mysqli.php on line 10
[16-Oct-2015 21:39:06 Africa/Johannesburg] PHP Warning: mysqli::close(): Couldn't fetch mysqli in /home/oneohon1/public_html/system/library/db/mysqli.php on line 58
[16-Oct-2015 21:39:09 Africa/Johannesburg] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/timezonedb.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/timezonedb.so: cannot open shared object file: No such file or directory in Unknown on line 0
[16-Oct-2015 21:39:09 Africa/Johannesburg] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/imagick.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/imagick.so: cannot open shared object file: No such file or directory in Unknown on line 0
[16-Oct-2015 21:39:09 Africa/Johannesburg] PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'oneohon1_admins'@'localhost' (using password: YES) in /home/oneohon1/public_html/system/library/db/mysqli.php on line 7
[16-Oct-2015 21:39:09 Africa/Johannesburg] PHP Notice: Error: Could not make a database link (1045) Access denied for user 'oneohon1_admins'@'localhost' (using password: YES) in /home/oneohon1/public_html/system/library/db/mysqli.php on line 10
[16-Oct-2015 21:39:09 Africa/Johannesburg] PHP Warning: mysqli::close(): Couldn't fetch mysqli in /home/oneohon1/public_html/system/library/db/mysqli.php on line 58


I dont have vqmod installed, must i install?


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by uksitebuilder » Sat Oct 17, 2015 3:44 am

No need for vqmod - you can ignore my comment on that.

From those errors you posted though, ignoring the timezone erros, it seems a databse connection cannot be established.

Please check your database settings in your config.php and admin/config.php

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by johnr@oneohone.co.za » Sat Oct 17, 2015 3:51 am

Ok So now page loads, but now when i got to www.oneohone.co.za or admin page i get errors at top of page

Warning: fopen(/home/oneohon1/public_html/system/storage/logs/openbay.log): failed to open stream: No such file or directory in /home/oneohon1/public_html/system/library/log.php on line 6Warning: fopen(/home/oneohon1/public_html/system/storage/cache/cache.language.1445028669): failed to open stream: No such file or directory in /home/oneohon1/public_html/system/library/cache/file.php on line 49Warning: flock() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 51Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 53Warning: fflush() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 55Warning: flock() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 57Warning: fclose() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 59Warning: fopen(/home/oneohon1/public_html/system/storage/cache/cache.currency.1445028669): failed to open stream: No such file or directory in /home/oneohon1/public_html/system/library/cache/file.php on line 49Warning: flock() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 51Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 53Warning: fflush() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 55Warning: flock() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 57Warning: fclose() expects parameter 1 to be resource, boolean given in /home/oneohon1/public_html/system/library/cache/file.php on line 59


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by uksitebuilder » Sat Oct 17, 2015 4:02 am

Looks like a file and/or folder permissions problem.

Please check your system/storage/logs folder and system/storage/cache fodler has write permissions

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by johnr@oneohone.co.za » Sat Oct 17, 2015 4:05 am

I dont have a system/storage folder, plus only have ftp access to webserver. must i just create a storage folder?


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by uksitebuilder » Sat Oct 17, 2015 4:25 am

system/storage was actually introduced in the latest opencart 2.1.0.1

So it looks like you may have some files installed from the latest opencart ? rather than from 2.0.3.1

You can create the following folders to see if it resolves the problem.

system/storage/
system/storage/logs/
system/storage/cache/

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by johnr@oneohone.co.za » Sat Oct 17, 2015 4:44 am

Thank UK site builder that worked. Thanks for all your help.


Posts

Joined
Wed Oct 14, 2015 3:26 pm

Post by EvolveWebHosting » Sat Oct 17, 2015 4:45 am

Looks like you're making progress and the redirect worked.

I don't know why Opencart doesn't ship with this, but add this somewhere in the top of your .htaccess file (not in the RewriteEngine on section)

<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>

This is a side tip but I noticed the Font Awesome icons weren't displaying and this code will fix that.

Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA
Who is online

Users browsing this forum: No registered users and 26 guests