0

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!

  • I understand you are using EE, but really this question appears to be an nginx question, and you will likely have better luck getting an answer on serverfault.com or stackoverflow.com. Also, I would take your time to properly format your question if you ask elsewhere, this is very messy and hard to read. Use this guide: stackoverflow.com/editing-help – jrothafer Feb 8 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.