Some urls are generated via our script. I need to trim all these via htaccess;
I have a few hundred of them, so all ?xxx have to be cleaned.
ie:
domain.com/page.html?word=gclid=4nwseuoSg
to
domain.com/page.html
or anything starting with ?, the ? and the rest is not needed.
I tried RewriteRule ^\?(.*)$ / [R=301,L] but did not work 🙁
What do I have to use instead of \?(.*) ?
the path doesn’t contain the querystring. Use RewriteCond to match any none-empty querystring.
I also added a condition that the url has to end in
.htmljust in case you want to add some php script in the future.