How to conditionally redirect from an AngularJS route

I am making a change to my site and need to account for backward compatibility, so that old links resolve to new links.

I have an existing route (/page), which will remain the same, but I want to check for some URL parameters, and if present, manipulate the URL and redirect to the updated page.

I realize I can do this in the controller, but there is lots of other logic (for better or worse) that I don’t want to run

Q: Can I conditionally inspect and update the URL for a route in my $routeProvider?

angular.module('app')
    .config(function ($routeProvider) {
        $routeProvider.when('/page', function(){
            // if some old condition is found
            if ($location.search().oldParam) {
                // modify the current URL
                $location.search('newParam', 'true').replace();
                // replace with some new URL 
                $location.path('/newPage').replace();
                // Now load the new route instead
            }
        });

Source: AngularJS