Script for Removing part URL at htaccess

I have Url : https://example.com/edun?fbclid=IwAR3r-md77G9VQGkHvowhcCVF6kOAg7f43prXv5gCLLiefEG1EMzE3CTJNc0

I want to change this link above to : https://example.com/edun

How to do this at .htaccess ?

Thanks

1 answer

  • answered 2018-11-08 09:52 iiic

    fbclid is evil :D

    you can use something like

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{QUERY_STRING} ^(.*)?+&+fbclid=[^&]+((?!&?).)*$ [NC]
    RewriteRule ^/?(.*)$ /$1? [R=302,NE]
    RewriteCond %{QUERY_STRING} ^(.*)?+&+fbclid=[^&]+&?(.*)$ [NC]
    RewriteRule ^(.*)$ /$1%1%2 [R=302,L,NE]
    

    and you also must have mod_rewrite in your appache available and enabled