WP 301 redirect keeping the GET parameter

I am trying to redirect old pages that look like: http://test2.com/song.php?id=15 to http://test2/song/15 with .htaccess. The new site is powered by WordPress, that already had a .htaccess initially. A modified version of it is below:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^/?song/([^/]+)/?$ song.php?id=$1 [L,QSA]

RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

My custom code is in the middle. It doesn’t work and I am really desperate on that. Any help would be appreciated.

Read more here: WP 301 redirect keeping the GET parameter

Leave a Reply

Your email address will not be published. Required fields are marked *