im trying to remove the fbclid segments form the urls shared in this social network, because mess my cache (create a new dynamic url everytime when a user click in the facebook share).
I found a example, but im a newbie in Nginx and i not shure if is the correct way to do it this:
==============================
server {
server_name mywebsite.com; root /var/www/mywebsite; index index.php;
location / { index index.php; try_files $uri $uri/ @ee; }
location @ee { rewrite ^(.*) /index.php?$1 last; }
location ~* .php$ { fastcgi_pass unix:/run/php/php7.2-fpm.sock; include fastcgi_params; fastcgi_index index.php5; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }
# if redirect map is active, do 301 to the new url if ( $redirect_fbclid ) { return 301 $redirect_fbclid; }
http {
# redirect map in http block - remove fbclid argument from the end map $request_uri $redirect_fbclid { "~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$" $1; }
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mywebsite.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mywebsite.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}server { if ($host = mywebsite.com) { return 301 https://$host$request_uri; } # managed by Certbot
server_name mywebsite.com; listen 80; return 404; # managed by Certbot
}
=====================
Thanks!