I have a website with several URLs like these:
domain.com/aff_link.php?id=363
and I need to redirect all of them to a subfolder called "old"
like this:
domain.com/old/aff_link.php?id=363
those numbers at the end go from 2 up to 4 digits.
How can I do this in htaccess?
Currently I have this code
RewriteCond %{QUERY_STRING} (^|&)(id)=[^&]+ [NC]
RewriteRule ^(/.*)?$ http://domain.com/old? [R=301,L,NC]
but that redirects everthing to domain.com/old/ so as you can see I do not know what I am doing, please help. Thank you in advance.
This should be pretty close ...
Watch out for leading slashes depending on whether this is in a VirtualHost or Directory or .htaccess block.