I want to redirect URLs with a query string to another query string using .htaccess
From: https://example.com/?smp=123456 (Any number after =)
To: https://example.com/?p=123456 (Same number as in From URL)
I tried following but it’s not working.
RewriteEngine on
RewriteCond %{QUERY_STRING} ^/?smp=([0-9]+)$ [NC]
RewriteRule ^$ https://www.example.com/?p=$ [R=301,L]
>Solution :
RewriteEngine On
RewriteCond %{QUERY_STRING} ^smp=([0-9]+)$ [NC]
RewriteRule ^$ /?p=%1 [R=301,L]