Page 1 of 1

Cookieless Domain for images on OC2

Posted: Tue Sep 20, 2016 6:59 pm
by Khal
Has anyone managed to create a cookieless domain for the image folder on OC2?

I have read through the forum posts on this topic, especially those by IPCAM, and seen the extension to do this on OC1.5xx but cannot find how to successfully implement one on OC2.0.1.1

I have created an alias (subdomain) and transferred my images to this new domain. I have changed the image directory in config files to point at this new domain, but this does not work. When I follow the steps given in this article: http://www.wesleysmits.com/how-to-set-u ... ss-domain/ and add the code to .htaccess file, my site goes offline.

Any ideas how to implement this on OC2?

Thank you for your help

Re: Cookieless Domain for images on OC2

Posted: Tue Sep 20, 2016 7:52 pm
by IP_CAM
change/add to the your config.php files, to look like this, if you use http://www.
by default:

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://www.bigmax.ch/oc22/');
define('HTTP_IMAGE', 'http://bigmax.ch/oc22/image/');

// HTTPS
define('HTTPS_SERVER', 'http://www.bigmax.ch/oc22/');
define('HTTPS_IMAGE', 'http://bigmax.ch/oc22/image/');
---
And try this VqMod:
Ernie
---

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[HTTP_IMAGE + HTTPS_IMAGE Links and Sizes]]></id>
<version><![CDATA[OC v.2.x]]></version>
<vqmver><![CDATA[2.5]]></vqmver>
<author><![CDATA[Ernie - IP_CAM]]></author>

<file name="catalog/model/tool/image.php">
<operation error="skip">
	<search position="replace"><![CDATA[return $this->config->get('config_ssl') . 'image/' . $new_image;]]></search>
	<add><![CDATA[return HTTPS_IMAGE . $new_image . '" width="' . $width . '" height="' . $height;]]></add>
</operation>            
    
<operation error="skip">
	<search position="replace"><![CDATA[return $this->config->get('config_url') . 'image/' . $new_image;]]></search>
	<add><![CDATA[return HTTP_IMAGE . $new_image . '" width="' . $width . '" height="' . $height;]]></add>
</operation>                  
</file>

<file name="admin/model/tool/image.php">
<operation error="skip">
	<search position="replace"><![CDATA[return HTTPS_CATALOG . 'image/' . $new_image;]]></search>
	<add><![CDATA[return HTTPS_IMAGE . $new_image . '" width="' . $width . '" height="' . $height;]]></add>
</operation>            
    
<operation error="skip">
	<search position="replace"><![CDATA[return HTTP_CATALOG . 'image/' . $new_image;]]></search>
	<add><![CDATA[return HTTP_IMAGE . $new_image . '" width="' . $width . '" height="' . $height;]]></add>
</operation>                  
</file>

<file name="catalog/controller/payment/skrill.php,catalog/controller/total/voucher.php,catalog/model/checkout/order.php,catalog/model/openbay/ebay_product.phpcatalog/model/tool/image.php" error="skip">
<operation error="skip">
	<search position="replace"><![CDATA[$this->config->get('config_url') . 'image/']]></search>
	<add><![CDATA[HTTP_IMAGE]]></add>
</operation>
    
<operation error="skip">
	<search position="replace"><![CDATA[$this->config->get('config_ssl') . 'image/']]></search>
	<add><![CDATA[HTTPS_IMAGE]]></add>
</operation>
</file>
	
</modification>

Re: Cookieless Domain for images on OC2

Posted: Tue Sep 20, 2016 8:19 pm
by Khal
Hi Ernie,

Thanks for getting back to me

I do not use www. prefix
So should I just remove the www from the first lines?

Here are my existing lines:

Code: Select all

// HTTP
define('HTTP_SERVER', 'https://khaleejiabaya.com/');

// HTTPS
define('HTTPS_SERVER', 'https://khaleejiabaya.com/');
I do not have

Code: Select all

define('HTTP_IMAGE', 'http://bigmax.ch/oc22/image/');
Should I add this? And do I need to change the code:

Code: Select all

define('DIR_IMAGE', '/...../khaleejiabaya.com/public_html/image/');
I guessI don't need the new domain alias for this way?

I do not have a vqmod folder- I use Extension Installer. Would it be possible to get this code as an ocmod?

Thank you so much for your help!

Re: Cookieless Domain for images on OC2

Posted: Tue Sep 20, 2016 10:17 pm
by IP_CAM
the image link has to be the OPPOSITE from the Site Link, or you have no cookie free image linking, it's as easy as that !
So, http://shop-link should equal http://www.image-link, or reverse !!
And this has NOTHING to do with the SERVER PATH's, we are talking about HTTP(s) LINKS, not Server PATH's !
Ernie

Re: Cookieless Domain for images on OC2

Posted: Tue Sep 20, 2016 11:12 pm
by Khal
Ok I understand. I switched the www in config files and also uploaded the vqmod you gave, thanks!

My images are now loading from the www. version of the site from the cache. When I check my site on gtmetrix, it still says I am not using a cookie free domain for my images. I don't understand?

Re: Cookieless Domain for images on OC2

Posted: Wed Sep 21, 2016 1:59 am
by IP_CAM
sure, it works ! But some images still have to be re-linked manually, i.E., within the HEADER.TPL File,
and such cannot be added simply in a VqMod, because it depends on a Theme, used, to make such work.
And as long as you have one such image, on your shop page tested, GtMetrix will complain :D
Ernie

Re: Cookieless Domain for images on OC2

Posted: Wed Sep 21, 2016 2:11 am
by Khal
Ok I see. All of those images showing as not cookie-free are images on my homepage. These same image links also show up under the issue "Minimize redirects"
For some reason, the images on my homepage are still being re-directed from my old http site, not the https version.

I recently installed an SEO module, do you think this has something to do with it? I'm not sure if this issue was present before adding this module. I have the default theme so I don't know how it can be theme-related?

Thank you so much for your help and for showing me how to set this up :) :)

Re: Cookieless Domain for images on OC2

Posted: Wed Sep 21, 2016 11:44 am
by IP_CAM
you seem to have reached the point, where you need Pro Assistance. Someone has to check your
Shop-Settings, and make sure, that you have configured everything on order, it wont be done by
guessing around in the dark. There are too many unknowns, as it looks! ;)

Ernie

Re: Cookieless Domain for images on OC2

Posted: Wed Sep 21, 2016 4:39 pm
by Khal
Ok thanks for all your help :)

Re: Cookieless Domain for images on OC2

Posted: Mon Feb 27, 2017 8:46 am
by saliverdim
please help me for oc2.0.3.1 always error and not work :(

/home//public_html/vqmod/vqcache/vq2-admin_model_tool_image.php on line 40

Re: Cookieless Domain for images on OC2

Posted: Tue Feb 28, 2017 3:56 am
by saliverdim
help me please

Re: Cookieless Domain for images on OC2

Posted: Tue Mar 28, 2017 1:24 am
by saliverdim
please please help me ?