I was trying to rewrite the query of a page on my site so that it wouldn't be exposed, but no matter what I write, the server doesn't seem to be able to rewrite the URL, even with the regex working perfectly.
Example: /news/new.html?id=nEJjeqwjeKBEwkqbjBKEJqwbkjQWEB
Target: /news/nEJjeqwjeKBEwkqbjBKEJqwbkjQWEB or /news/new
When I try to remove the query in .htacess it doesn't seem to work at all. I already tried using this code for example:
RewriteCond %{QUERY_STRING} ^(.*)&?id=[^&]+&?(.*)$ [NC]
RewriteRule ^/?(.*)$ /$1?%1%2 [R=301,L]
But nothing happens, even putting the exact same url that is in the regex. I'm pretty new to website development and I have almost no knowledge of apache, can anyone help me?
Edit: I've already tried several codes here from Stackoverflow, none seem to work.