So from our old server we want almost all URLs to be redirected to new server except a few.
So I tried the following .htaccess rule:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !\.(css|js|Js|png|jpg|gif)$ [NC]
RewriteCond %{REQUEST_URI} !^/admin/
RewriteCond %{REQUEST_URI} !^/albums/
RewriteCond %{REQUEST_URI} !^/songs/
RewriteCond %{REQUEST_URI} !^/update_list.php
RewriteRule (.*) http://www.newserver.com/$1 [R=301,L]
The idea is that other than the admin, albums, songs URLs and update_list php file and the asset files (css, js, images) everything else should redirect to new server.
This works "almost" fine - admin URL correctly stays in old server, as does update_list. All other legacy urls redirect to the new server.
However my problem is that albums and songs URLs also keep redirecting to new server.
I am not sure why. Just so you are aware the songs url is of the structure
oldserver.com/songs/album-id/song-name
And the albums URL has session values set based on query params when loading.
Can anyone help me? I have been sitting with this for over 4 hours now :( And I have tried almost all kinds of rule syntaxes I read online. Any advice/pointers is greatly appreciated.