To view the solution for handling similar URLs with different controllers in AngularJS, please refer to 18131834.
For a different approach, you can utilize the ui-router library, which allows for regular expressions in route parameters:
$stateProvider.state("artists-index", {
url: "/artists/{page:[0-9]*}",
templateUrl: "/www/artists/index.html",
controller: "ArtistsIndexController"
});
$stateProvider.state("artists-profile", {
url: "/artists/{name}",
templateUrl: "/www/artists/profile.html",
controller: "ArtistsProfileController"
});