Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

redirect only every 2nd or 3rd request (no replies)

$
0
0
I'm trying to set up a rule which is going to redirect only every second or third request only if the URL contains a specific string.
I did already the redirect based on a string in the URL but I can't find how to redirect only every second on third request:

if ($request_uri ~ .*.WHATEVER_STRING.*) {
if (this is the 2nd request than) {
rewrite ^/(.*) WHATEVER_URL;
}
}

Viewing all articles
Browse latest Browse all 7229


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>