I have this url: domain.com/foo/bar?arg1=a&arg2=b and I would like: domain.com?index=foo/bar&arg1=a&arg2=b my attempt works but I do not think it is correct RewriteRule (.*)?$ indexr.php?url=$1 [QSA,PT,L]