Assuming you're using Apache the solution is to use mod_rewrite. The following in your .htaccess should achieve what you're after. I'm assuming that %YEAR% is four numerals and %MONTH% is two numerals, adjust accordingly if this is not the case.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(/\d{4}/\d{2}/)([^/]+)(/.*)$
RewriteCond %2 ^category1|category2|category3|category5$
RewriteRule ^(.*)$ http://other.example.com$1 [redirect=permanent,last]
Explanation of each line:
- Enable mod_rewrite
- Check if the url is /four numerals/two numerals/anything/anything else
- If the above pattern matched then check if the text captured by the second set of brackets matches any of the word separated by pipes
- If the above condition matched then redirect to the same path at the server other.example.com