Struggle with htaccess 301 redirection

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

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(.*)$ [R=301,L]
RewriteCond %{QUERY_STRING} ^aid=4$
RewriteRule ^lang/es/artist.php(.*)$ [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.