Post by 13pixels » Thu Jan 12, 2017 9:37 pm

Hey Guys,

I have tested my website on tools.pingdom.com and overall I got a nice score. But I keep running into a "F" grade on serve static content from a cookieless domain. I have seen a couple of websites on how to solve this and even some topics here. But none had the perfect solution. Does anybody know how to solve this?

I run OC 1.5.6.4 and Journal 2 theme.

Looking forward to the reply's

Attachments

screenshot-tools.pingdom.com-2017-01-12-14-36-32.png

Pingdom Performance insights - screenshot-tools.pingdom.com-2017-01-12-14-36-32.png (33.71 KiB) Viewed 1596 times


Newbie

Posts

Joined
Thu Oct 08, 2015 3:25 pm

Post by IP_CAM » Thu Jan 12, 2017 9:45 pm

sarch in the Extension Section for this:
https://www.opencart.com/index.php?rout ... n_id=23506
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by 13pixels » Thu Jan 12, 2017 10:08 pm

Thanks! I see you have made this? Would you give any support on this?

Newbie

Posts

Joined
Thu Oct 08, 2015 3:25 pm

Post by IP_CAM » Fri Jan 13, 2017 2:59 am

Well, one does not really need support, everything is descrided, and it usually works,
independent of the Theme used. But I don't know about the Journal Theme, because
Journal is not just a Theme, by the Volume of Code it add's to a Shop Site! :D
So, I could NOT be of help anyway, but let me try once more again to get BASIC:
---
1. In your CONFIG.PHP Files, you PROBABLY have the Site URL configured as:
http : //www. yoursite.com/ (or: http: //www. yoursite.com/shop/)
and therefore, your OC-default IMAGES are linked like:
http : //www. yoursite.com/image/ (or: http: //www. yoursite.com/shop/image/)
---
2. To MAKE image-links cookiefree, your IMAGE links must only! be called as:
http : //yoursite.com/image/..., not http : //www. yoursite.com/image/...,
because, for a Browser, this is another Site, as http:// without a www.
Alias-Name added to .;)
---
3. IF the REVERSE Case applies, everything is done the opposite Way,
and images are to be linked trough www.!
---
Take this sample (admin) technically simple second-domain-image
config.php file content:
(the ROOT config.php would be linked similarly, just without the admin Lines!)

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'http://www.velomech.ch/shop/admin/');
define('HTTP_CATALOG', 'http://www.velomech.ch/shop/');
define('HTTP_IMAGE', 'http://velomech.ch/shop/image/');
// HTTPS
define('HTTPS_SERVER', 'http://www.velomech.ch/shop/admin/');
define('HTTPS_CATALOG', 'http://www.velomech.ch/shop/');
define('HTTPS_IMAGE', 'http://velomech.ch/shop/image/');
And now, we use a VqMod, to tell the OC Software, that, in the:
catalog/model/tool/image.php File,
(possibly moved elsewhere in later OC-2 Versions!)
it's both default OC Code Linking Routines, looking like:
return $this->config->get('config_ssl') . 'image/' . $new_image;
return $this->config->get('config_url') . 'image/' . $new_image;

are not longer used, as default Source- 'internal' GET-Routine, but replaced
by a config.php defined IMAGE HTTP Link, and the VqMod,
thereby changing (among another line, in other xxx.php Files) those Lines:
---
return $this->config->get('config_ssl') . 'image/' . $new_image;
to:
return HTTPS_IMAGE . $new_image;
and:
return $this->config->get('config_url') . 'image/' . $new_image;
to:
return HTTP_IMAGE . $new_image;
---
in the catalog/model/tool/image.php . And depending on, if it's a secure HTTPS
Site Call or a regular HTTP Call. And if the VqMod is switched OFF, everything works
as by DEFAULT again, exept for possibly manually rewritten image Links, like a Logo !
---
And this, combined with the added config.php Image Link Lines, makes your
Shop Images (largely) cookiefree. Exept for the Shop Logo, and a few other
oc-hardcoded linked images, wich I changed manually later, to look like, i.E., in the
... theme ... / template/common/header.tpl File:

Code: Select all

<a href="<?php echo $home; ?>"><img width="268" height="50" src="http://velomech.ch/shop/image/data/velomech_logo.png" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" class="img-responsive" /></a>
And to have most of your Stylesheets and Scripts also working cookiefree,
check on the image linked below, to see, how I linked MOST such in the header.tpl File,
in the HTTP way. ;)
---
Image:
http://www.ipc.li/os/cookiefree_styles_and_scripts.jpg
---
Just be careful with the USE of that ASYNC Delay-JS-command, it may
hinder most important Scripts from executing in order, if a Page is not reloaded first.
And this makes no sense, technically, regardless of, what ANY Site Test Tools
mean to this... ;)
---
And get all of your .CSS and .JS Stuff compressed, either by Google Pagespeed or GTMETRIX, by testing all possible Sections+Functions of your Shop, to get' em all
compressed! Or then, do it on a Site like here:
http://csscompressor.com/
http://javascript-compressor.com/
--
https://gtmetrix.com/
https://developers.google.com/speed/pagespeed/insights/
https://tools.pingdom.com/
---
And just be aware, FONTAWESOME and (possibly) BOOTSTRAP-related header
linking is NOT possible this way, leave them, as they are written, in the header.tpl, like:

Code: Select all

<link rel="stylesheet" type="text/css" href="catalog/view/fontawesome/css/font-awesome.min.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $this->config->get('config_template');?>/bootstrap/css/bootstrap.css" media="screen, projection" />
Or then, get at the FontAwesome/Bootstrap Code from a place like this, to have it
cookiefree too. It will NOT make the pageload any faster, the contrary may be the case,
but it at least displays it's OC-2 related ICON's, possibly used in your Theme too,
regardless of, how a Site URL is called! Wich is NOT the Case, at least with FontAwesome.

Code: Select all

<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
And to round it up, in the latest Test VqMod, linked below, the ever
OC-missing Image WIDTH + HEIGHT Tags are also added, if you use
this VqMod, then, GTMETRIX will really like you ! :D

My latest Test VqMod Version includes an ADMIN Image Link Section,
but it works only with selected IMAGE MANAGERS. If it does NOT longer display
Images in your Image Manager, or anywhere else, remove the entire ADMIN
Section from the VqMod! Should work anywhere, exept for possibly OC v.2.3.x.
http://www.openshop.li/downloads/image_sub_domain.zip
---
And check on my favoured .htaccess File, it could make a difference too ... :D
http://www.hitline.info/shop/index.php? ... ation_id=4
---
That's all, good Luck ! :D
Ernie
---
PS: And you may need something like this, to be inserted into your:
.htaccess file,
to make sure, all 'incorrect' Site Calls are 'redirected' to the correct URL!
It's now coded to switch HTTP://site to HTTP://WWW.site

Code: Select all

## PLACE IN:
# SEO URL Settings
RewriteEngine On
RewriteBase / ###  or your Shop-dir-Name, like RewriteBase /shop/  ###
## JUST BELOW THE ABOVE LINE! ##

#Force (http host) www to non www (optional)
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

#Force (https host) www to non www (optional)
#RewriteCond %{HTTPS} on
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

#Force (http host) non www to www (optional)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#Force (https host) non www to www (optional)
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
:crazy: END :crazy: never again...

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by villagedefrance » Sun Jan 15, 2017 8:49 pm

A very good and useful answer.

Great job Ernie!

OpenCart custom solutions @ https://villagedefrance.net


User avatar
Active Member

Posts

Joined
Wed Oct 13, 2010 10:35 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 48 guests