Struggle with htaccess 301 redirection

Hi,
I’m migrating an old site from custom php to wordpress and I’m really struggle with some 301 redirection that must be done in my htaccess, I would really appreciate some help, ideas or advises.

I would need to go from
http://www.mysite.com/lang/es/artist.php?aid=3
to
http://www.mysite.com/artistas/artistname/

This is what I got so far:

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/lang/es/artist.php$
RewriteCond %{QUERY_STRING} ^aid=3$
RewriteRule ^lang/es/artist.php(.*)$ http://www.mysite.com/artistas/some-artistname/? [R=301,L]
RewriteCond %{QUERY_STRING} ^aid=4$
RewriteRule ^lang/es/artist.php(.*)$ http://www.mysite.com/artistas/another-artistname/? [R=301,L]

Thanks for your time

I’ve being working on the topic and changed my approach with no luck

RewriteCond %{QUERY_STRING} aid=3
RewriteRule ^lang/es/artist\.php$ /artistas/artist-name/? [L,R=301]
RewriteCond %{QUERY_STRING} aid=4
RewriteRule ^lang/es/artist\.php$ /artistas/other-artist/? [L,R=301]

I moved the rule on top of the default rewrite rule from WP to solve it.
Thanks Rubber duck, you are always there when I need you.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.