Rotating object to another objects rotation on x axis [C#]

I want my player to go from one portal to another and change its rotation to the other portal’s rotation.
code:

void OnTriggerEnter(Collider other) {
		Debug.Log ("something hit the portal");
		other.transform.position = otherPortal.transform.position + otherPortal.transform.forward * 1;
		other.transform.rotation = otherPortal.transform.rotation;
	}

You could try using Look Rotation:

other.transform.rotation = Quaternion.LookRotation(otherportal.transform.forward);

EDIT: to anyone else reading this for help, you’ll need to read through the comments of this answer to see solutions.

This might help…