Redirect question

I changed how a site links.

How would I configure an htaccess file to do a 301 redirect from “?id=38” to “?page_id=38” ?

Thank you E

Is this in the root of the website?

If so


RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=(\\d+)
RewriteRule .? /?page_id=%1 [L,R=301]

That assumes the URL starts with ?id=something.
If it’s somewhere within the query_string, like ?a=1&id=something , it won’t work.

Thanks that worked like a charm. -E