Reputation: 4447
I was wondering about the usage of pagespeed with multiple domains or subdomain, and whether it works or not.
I found some question here at SOF with similar things I want to achieve except that I want to do that with subdomains or multiple domains.
I tried to use the following to make things work yet not sure if it does!!
ModPagespeedDomain http://www.example-1.com # domain 1 where to get images from
ModPagespeedDomain http://static.example.com # subdomain 1 where to get js files from
ModPagespeedDomain http://resources.example.com # subdomain 2 where to get css from
now I want to know if the following setting is ok or not:
ModPagespeedMapRewriteDomain http://www.example.com http://www.example1.com
ModPagespeedMapRewriteDomain http://www.example.com http://static.example.com
ModPagespeedMapRewriteDomain http://www.example.com http://resources.example.com
or should that be inline to the main domain only instead of listing them one by one...
so my question is this configuration correct?? if not, how do I correct it??
I hope it is not confusing...
Thanks
Upvotes: 2
Views: 3459
Reputation: 6387
It all depends on what you're trying to accomplish.
ModPagespeedDomain
directives work if you have mod_pagespeed installed on all three domains (for example, if they are all just separate VirtualHost
s on the same machine.). This will rewrite all resources on all 3 domains no matter which one the HTML is loaded from. Do not use these directives if mod_pagespeed is not running on the 3 resource domains.
ModPagespeedMapProxyDomain
will rewrite URLs from these 3 domains into www.example.com
. You would usually use this if you do not have mod_pagespeed installed on the 3 resource domains, but you do on www.example.com
. Note: You probably want something more like:
ModPagespeedMapProxyDomain http://www.example.com/images/ http://www.example1.com
ModPagespeedMapProxyDomain http://www.example.com/js/ http://static.example.com
ModPagespeedMapProxyDomain http://www.example.com/css/ http://resources.example.com
The subdirectories are necessary to make sure that mod_pagespeed knows which resources map back to which domains. Read the documentation for more details.
ModPagespeedMapRewriteDomain
is probably not what you want. That directive is basically only used for CDN configuration. It would rewrite URLs from the 3 resource domains to www.example.com
, but would not be able to respond to the request for those rewritten resources (It assumes that the domain you rewrite to is a pull CDN).
For more information, you can read the full PageSpeed Authorizing and Mapping Domains documentation.
Upvotes: 4