Search code examples
apachecpanelpagespeedmod-pagespeedgoogle-pagespeed

Specifying base URL with mod_pagespeed?


I've installed mod_pagespeed and I'm trying to figure out if this is possible to do.

Example URL:

<script src="/assets/build/js/test.js"></script>

The above URL is rewritten to this:

<script src="/assets/build/js/test.js.pagespeed.jm.QCz72nUS30.js"></script>

What I would like to do is for the URLs to be rewritten to the base of the website or to a folder that I specific. For example, I would prefer the rewritten URL to appear like this:

<script src="/test.js.pagespeed.jm.QCz72nUS30.js"></script>

Or something like this:

<script src="/sample-folder/test.js.pagespeed.jm.QCz72nUS30.js"></script>

Is this something that's possible to configure with mod_pagespeed? I want to do this for all images, javascript, and CSS files. Thanks in advance for any help you may be able to provide!


Solution

  • No, this isn't possible with mod_pagespeed. Here are the only URL rewrite control options available to you:

    https://developers.google.com/speed/pagespeed/module/restricting_urls

    You can rewrite the URL's with Apache's mod_rewrite. However, note the following limitations when doing so:

    https://code.google.com/p/modpagespeed/issues/detail?id=676