2

I've been looking at mod_pagespeed as a way to speed up my site. I currently load my CSS/JS from a separate domain to speed up loading of those resources. However, I like to break up my CSS/JS into useful functional chunks. This means, in the worst case scenarios I may have half a dozen CSS files and the same number of JS files being included on a single page.

So my question is. How can I use mod_pagespeed to continue loading files from a different domain but also use the combine_css/combine_js directives?

Endophage
  • 21,038
  • 13
  • 59
  • 90

1 Answers1

3

Yes, but you either need to run mod_pagespeed on both sites (and authorize both sites) or to rewrite the CSS/JS from the other domain to the one that runs mod_pagespeed.

For example, if you have mod_pagespeed installed on both your main site (http://www.example.com) and your static-content site (http://static.example.com), you can add:

ModPagespeedDomain http://static.example.com

to your pagespeed.conf file on www.example.com and this will authorize mod_pagespeed to rewrite those resources and continue to serve them from that domain. See http://code.google.com/speed/page-speed/docs/domains.html#auth_domains for doc.

If you want mod_pagespeed to rewrite resources from your static domain to your main domain you can add:

ModPagespeedDomain http://static.example.com
ModPagespeedMapRewriteDomain www.example.com static.example.com

which will tell mod_pagespeed to rewrite files in static.example.com and move them to www.example.com.

If you have more questions, feel free to contact us on our official email list: https://groups.google.com/group/mod-pagespeed-discuss

-Shawn Ligocki (mod_pagespeed team)

sligocki
  • 6,246
  • 5
  • 38
  • 47
  • The first example is pretty much exactly what I want to do. Thanks! – Endophage Jan 19 '12 at 22:31
  • @sligocki I have same problem . When combine_css,combine_javascript disabled everything works fine . Note in my setup static.example.com is Nginx and www.example.com is Apache . Any help ? Also asked here https://groups.google.com/forum/#!topic/mod-pagespeed-discuss/ZybktKbCKIE – Omid Kosari Mar 07 '15 at 12:47