I have a website that has an query string in the url that I want to rewrite. The url is domain.com/profile.php?user=sven
and I want it to redirect to domain.c
Update your htaccess to following,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?profile/(.*?)/?$ /profile.php?user=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /profile\.php\?user=([^]+)
RewriteRule ^/?profile\.php$ /users/%1? [L,R=301]
I hope this helps.