I know it could be easily solved i just looked everywhere and tried everything without sucess so i had to ask here ;
how do i 301 redirect index.php?p=(number) or /?p= to product.php?id=(number) with htaccess.
I thought this might work but it didnt
RewriteEngine on
RewriteBase /
RewriteRule ^(index.php|?)p\=([0-9] )$ product.php?id=$2 [R=301]
CodePudding user response:
With your shown samples/attempts, please try following htaccess rules. Make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteBase /
RewriteCond %{THE_REQUEST} \s/index\.php\?p=(\d )\s [NC]
RewriteRule ^ product.php?id=%1 [R=301,L]