Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove fbclid argument from the URL in Nginx
http {
...
# redirect map in http block - remove fbclid argument from the end
map $request_uri $redirect_fbclid {
"~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$" $1;
}
...
server {
...
# if redirect map is active, do 301 to the new url
if ( $redirect_fbclid ) {
return 301 $redirect_fbclid;
}
...
}
}
@lukapaunovic

This comment has been minimized.

Copy link

@lukapaunovic lukapaunovic commented Jan 9, 2019

Thanks a lot.

@marcusprice

This comment has been minimized.

Copy link

@marcusprice marcusprice commented Sep 27, 2019

Thank you for this.

@SalimF

This comment has been minimized.

Copy link

@SalimF SalimF commented Nov 10, 2019

works

@dieudv

This comment has been minimized.

Copy link

@dieudv dieudv commented Nov 14, 2019

works

@jorgedison

This comment has been minimized.

Copy link

@jorgedison jorgedison commented Jun 3, 2020

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment