How to remove get parameter from url with .htaccess?

Member

by lizzie , in category: Third Party Scripts , 4 months ago

How to remove get parameter from url with .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by addison , 4 months ago

@lizzie 

You can remove a get parameter from a URL using .htaccess by using the following RewriteRule:

1
2
3
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)param= [NC]
RewriteRule ^ %{REQUEST_URI}? [R=301,L]


This rule will remove the "param" get parameter from the URL. It will also redirect the user to the new URL without the get parameter, using a 301 (permanent) redirect.