Search code examples
nginxpermalinkspagespeedmod-pagespeedamp-html

How to Disable mod_pagespeed on a specific type of URLs


i've mod_pagespeed installed on my nginx server and i love it.

Recently, i installed AMP posts in my website and all permalink now have the /amp/ at the end of the URL.

The problem is that mod_pagespeed (at this time) doesn't support AMP tag, so the console show me some errors. But when i insert ?PageSpeed=off at the end of the amp URLs, AMP is validated.

So, i'd like, if it's possible, to deactivate mod_pagespeed only for all URLs that have the /amp/ at the end.

The permalink structure is: https://www.example.com/postname/

The permalink structure for AMP is: https://www.example.com/postname/amp/

So, mod_pagespeed should work only on the first permalink structure.

The code that i tried to put into mod_pagespeed is the follow:

pagespeed Disallow “https://*example.com/*/amp/*”;

It isn't refuse by the module, but it don't turn off the pagespeed module on the AMP posts. Can you help me about that?

Many thanks in advance.


Solution

  • Add this in your pagespeed.conf file:

    pagespeed Disallow */amp/*;