Israeli court orders controversial wall rerouted