I have a website where I need to 301 redirect all old pages that are incoming from old URLs like /?page_id=261
, /?page_id=204
, /?page_id=2677
and so on to the main home page.
What would be a proper way of doing it? Will something like this in .htaccess
work? I do not want to redirect all 404's - just these type of old links.
RedirectMatch 301 ^/?page_id=4&n=$1 https://www.example.com/
&n=$1
supposed to be referring to in your example code? There's no mention of this in your example URLs. – MrWhite May 31 '19 at 14:06