Whenever it's a bot, I'd like to append a single query parameter at the end of the URL in nginx.
So that URLs like https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9/ will become https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9/?crawl=1
Or without the slash at the end https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9 will result into https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9?crawl=1
If the parameter crawl already exist, no modification is wanted. How can I do that in nginx?
I tried with this but it didn't work
if ($crawling = 1) {
rewrite ^(.*)$ $1?crawl=1? break;
}
Any clues?