A literal question mark in the URL marks the start of the query string, so you can test if the query string contains anything and redirect if it does. Using Apache mod_rewrite in .htaccess:
RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteRule (.*) /$1? [R=301,L]
The RewriteRule
pattern matches against the URL-path, which notably excludes the query string.
The ?
(question mark) on the end of the RewriteRule
substitution effectively removes the query string from the rewritten URL by creating an empty query string. The question mark itself does not appear in the resulting URL. If you are on Apache 2.4+ then you can use the QSD
flag instead (Query String Discard).
If you only need to do this for a specific URL, then change the RewriteRule
accordingly:
RewriteRule ^(residential-properties/projectname/)$ /$1? [R=301,L]