Does Cloudflare cache external resources like scripts?


If I activate - Caching Level: Ignore query string

Will external scripts, CSS, and requests get cached? (I don’t want them to be cached)

Example: Below request - Will it get cached?

No, anything not going through Cloudflare wont be cached.

1 Like

No, anything not going through Cloudflare won’t be cached.” - ok, thanks. This is what I wanted.

I’ve activated - Caching Level: Ignore query string

But it doesn’t strip to

[ - This is the page visited from a link. But it should redirect (or ignore) to]

But how can I achieve this?

It wont strip the query string, it simply wont take it into consideration for caching.

If you want to strip the query string you could probably achieve this with a redirecting page rule of that sort

**?* -> $$2

Untested of course.

I have used all my free 3 page rules.

Can I configure it with .htaccess? There is no disadvantage in choosing .htaccess over pagerule, right?

In that case you could purchase more page rules.

If that is not possible you could probably also achieve that via .htaccess, however that would be a question for StackExchange then.

in theory it will be sligly slower because:

in htaccess request flow:

cloudflare -> origin server(htaccess) -> cloudflare -> redirect

vs pagerule:

cloudflare -> redirect

nothing I will worry about unless you have good reason to be worried.

the other question is why do you want to redirect when there is query string? what are you trying to solve? maybe you are looking for the


I’m using Google’s AMP. The AMP pages are served from Google’s server.

The AMP pages have links to my non-AMP pages.

But when the visitors come through those links, it adds something like ?_gl=1*um0ntk*_ga*YW1wLUVyYS1QbHgwcFp1SEJBYVlGSlNYdWNQUWI

This affects some functionality of my site. So I want to remove/redirect it.


should redirect to

Only the _gl= seems to be constant. After that alphanumeral characters and symbols are there (which changes for every url). Which has to be removed, from the string query.

I have tried:

    <IfModule mod_rewrite.c>
    RewriteEngine On  
    RewriteCond %{QUERY_STRING} _gl=    
    RewriteRule ^ %{REQUEST_URI}? [L,R]


    <IfModule mod_rewrite.c>
    RewriteEngine On  
    RewriteCond %{QUERY_STRING} ^_gl=*    
    RewriteRule ^ %{REQUEST_URI}? [L,R]

And other rules. But nothing seems to work.

Unfortunately that would be an Apache specific question and is better suited for aforementioned forums like StackExchange. Though I am pretty sure somebody had already tried that before, so I’d expect an online search to return something as well.

Yeah this is off topic. Online search didn’t help. Hope I will get help somewhere.


Those questions seems to answer simple defined redirect

For example:

I want to redirect from:  



You can use this rule in your root .htaccess:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^lang= [NC]
RewriteRule ^(ca/blog/?)$ %{REQUEST_URI}? [NC,L,R=301]

But my path is


RewriteCond %{QUERY_STRING} ^?_gl= [?] The Regular expression for match anything is (.*) , [\s\S]* , $ ,

But nothing seems to work.

I am not quite sure how your query string is different from the examples in the provided link, but anyhow, we really are beyond the forum’s scope at this point. I am quite sure StackExchange will eventually have the right answer to your use case.

My link changes after ?_gl=Afterthis-the-char-varies-with-symbols-numbers-etc

I fixed the problem. I just had to move my existing redirect rule to the top.

This topic was automatically closed after 14 days. New replies are no longer allowed.