Is it illegal to run exhaust behind the truck cab?

I have a 99 ford f150 an it needs a exhaust pipe. Some body told me I had to run behind the cab. Then someone else says no. Got to run behind rear tire.

Every state is different but I know in Utah the exhaust has to exit past the rear of the passenger compartment so for cars and SUV it would be out the back but trucks though behind the cab is fine.