How to remove get parameter from url with .htaccess?

Member

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

How to remove get parameter from url with .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by addison , 9 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.

Related Threads:

How to add a parameter to a url using .htaccess without breaking in wordpress?
How to remove specific query_string parameter in .htaccess?
How to redirect subdirectory to url parameter in .htaccess?
How to get url parameter in controller in laravel?
How to remove .cgi from url with .htaccess?
How to remove url parameters in php using .htaccess?