After going in deep, i finally came to know that urlrewritefilter is actually setting relative path to root directory in the value of header location in response to the requested path, by only replacing the matching regex pattern, as mentioned above. This can be seen here
Therefore the browser actually interpret this as relative path to the current domain and gives 404 error.
This can be solved using the custom redirect action to handle such type of request.