mandrin Posted September 26, 2010 Share Posted September 26, 2010 Hi.This post was made in another forum section, but it definitely should be here in the SEO section...Ok, question is... Would it be possible to stop Prestashop sending cookie information in headers for static content such as images and CSS?The reason I ask is that I ran Page Speed and it suggested: "Serve static content from a cookieless domain"I think that this unduly causes your website load time to suffer for no reason, imho. Unless of course someone can give a valid reason why this needs to be (I am not a coder/developer bty ).Regards, Link to comment Share on other sites More sharing options...
Prestacampus Posted October 3, 2010 Share Posted October 3, 2010 This means you should create a subdomain especially for your images and css files say static.yourdomain.com is an example, and put your images and css there.Go to config/defines.inc.php and add some lines of codes: if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { define('_THEME_IMG_DIR_', 'http://img2.xxx.com/'); define('_THEME_CSS_DIR_', 'http://css.xxx.com/'); define('_THEME_JS_DIR_', 'http://js.xxx.com/'); define('_THEME_CAT_DIR_', 'http://img1.xxx.com/c/'); define('_THEME_PROD_DIR_', 'http://img1.xxx.com/p/'); define('_THEME_MANU_DIR_', 'http://img1.xxx.com/m/'); define('_PS_IMG_', 'http://img1.xxx.com/'); define('_PS_ADMIN_IMG_', 'http://img1.xxx.com/admin/'); } else { define('_THEME_IMG_DIR_', _THEMES_DIR_._THEME_NAME_.'/img/'); define('_THEME_CSS_DIR_', _THEMES_DIR_._THEME_NAME_.'/css/'); define('_THEME_JS_DIR_', _THEMES_DIR_._THEME_NAME_.'/js/'); define('_THEME_CAT_DIR_', __PS_BASE_URI__.'img/c/'); define('_THEME_PROD_DIR_', __PS_BASE_URI__.'img/p/'); define('_THEME_MANU_DIR_', __PS_BASE_URI__.'img/m/'); define('_PS_IMG_', __PS_BASE_URI__.'img/'); define('_PS_ADMIN_IMG_', _PS_IMG_.'admin/'); } as is explained by the official Prestashop document (where xxx is your domain). Link to comment Share on other sites More sharing options...
rocky Posted October 3, 2010 Share Posted October 3, 2010 That's right. At the moment, you must modify code, but PrestaShop v1.4 lets you define "media servers" on the Preferences tab to serve static content from a cookieless domain. Link to comment Share on other sites More sharing options...
Mamica Posted October 4, 2010 Share Posted October 4, 2010 This means you should create a subdomain especially for your images and css files say static.yourdomain.com is an example, and put your images and css there.Go to config/defines.inc.php and add some lines of codes: if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { define('_THEME_IMG_DIR_', 'http://img2.xxx.com/'); define('_THEME_CSS_DIR_', 'http://css.xxx.com/'); define('_THEME_JS_DIR_', 'http://js.xxx.com/'); define('_THEME_CAT_DIR_', 'http://img1.xxx.com/c/'); define('_THEME_PROD_DIR_', 'http://img1.xxx.com/p/'); define('_THEME_MANU_DIR_', 'http://img1.xxx.com/m/'); define('_PS_IMG_', 'http://img1.xxx.com/'); define('_PS_ADMIN_IMG_', 'http://img1.xxx.com/admin/'); } else { define('_THEME_IMG_DIR_', _THEMES_DIR_._THEME_NAME_.'/img/'); define('_THEME_CSS_DIR_', _THEMES_DIR_._THEME_NAME_.'/css/'); define('_THEME_JS_DIR_', _THEMES_DIR_._THEME_NAME_.'/js/'); define('_THEME_CAT_DIR_', __PS_BASE_URI__.'img/c/'); define('_THEME_PROD_DIR_', __PS_BASE_URI__.'img/p/'); define('_THEME_MANU_DIR_', __PS_BASE_URI__.'img/m/'); define('_PS_IMG_', __PS_BASE_URI__.'img/'); define('_PS_ADMIN_IMG_', _PS_IMG_.'admin/'); } as is explained by the official Prestashop document (where xxx is your domain). HyNot working, u can send me your defines.inc.php, please?THX Link to comment Share on other sites More sharing options...
A-Z Hosting Posted October 20, 2010 Share Posted October 20, 2010 define('_THEME_IMG_DIR_', 'http://img2.xxx.com/');Hmmm.... doing it like this is all fine and dandy but it still sort of feels like putting a bandaid on a knife wound. The million dollar question is why weren't sessions used instead of cookies. W3C as well as PHP themselves have moved away from cookie usage a long time ago. Don't get me wrong I absolutely adore Prestashop from what I have seen so far it has much promise. There are just a couple of big issues to work with such as getting away from the large chunks of cookies and converting to sessions either /tmp based sessions or database stored. Back to this mirroring of images and css on other domains. How do you plan to keep your SSL warnings at bay and not getting a "mixed content" warning on each and every page? Just can't mix protocols and domains that way. Link to comment Share on other sites More sharing options...
diana13 Posted November 15, 2010 Share Posted November 15, 2010 I've made the subdomains, but they still have cookies. I found that cookies are set for mydomain.com and not for www.mydomain.com. In this case, all cookies are passed to all subdomains (from what I've read in this matter). How can I set cookies for www.mydomain.com? I suppose I should modify classes/Cookie.php, but I'm not a programmer and I don't find where to modify. Link to comment Share on other sites More sharing options...
eCasper Posted November 21, 2010 Share Posted November 21, 2010 Hi, @Diana13,Did you find a solution for your issue? I also created sub domains and CNAME record aliases too. but still it seemed cookies are getting saved there.Can anyone help me with this?Thanks in advance! Link to comment Share on other sites More sharing options...
diana13 Posted November 22, 2010 Share Posted November 22, 2010 No, I didn't find a solution, though this is the solution I want, with subdomains.But I've tested and it works just fine with another domain.I have some problems though: I've copied themes/img and themes/css on anotherdomain.com and I've changed properly in config.inc.php and it's ok.But there are some errors for the other elemnts, like theme/js and img, becouse before the url is wrong.It apears like: http://www.mydomain.comhttp://anotherdomain.com/js/ for example. And I really don't know where to fix this. Link to comment Share on other sites More sharing options...
bluemoon Posted July 16, 2011 Share Posted July 16, 2011 @diana : Sorry for asking such a long time later but have u got any solution concerning "But there are some errors for the other elemnts, like theme/js and img, becouse before the url is wrong.It apears like: http://www.mydomain.comhttp://anotherdomain.com/js/ for example. And I really don’t know where to fix this."I got the same error and can't find any solution, either in french or in english forums, prestashop.com or any other... I had to create 3 subdomains from scratch and then use my tiny hands to modify the code in almost all the tpl and some php files.And still, I have to set cookieless domains on my old 1.3.6 version. Link to comment Share on other sites More sharing options...
hillarywindson Posted August 8, 2011 Share Posted August 8, 2011 The speed of a web page is called "page load time." It is simply that the website pages takes time to load so as to become visible, once the user requests them. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now