Routing in vehicular ad hoc networks (VANETs) enables efficient communication and data exchange between vehicles and infrastructure components, which is a critical aspect of providing intelligent transportation systems (ITS). Due to the dynamic nature of VANETs, where vehicles have high mobility and frequent link disconnections, secure routing protocols are essential for establishing reliable and efficient communication paths. Employing trust criteria in routing is an effective solution that routing protocols use to become secure. In this paper, we propose an RSU-assisted trust-based routing protocol for VANETs (RTRV), which considers trust criteria to provide secure routing. To identify and limit malicious nodes from disrupting the routing, RTRV provides a more reliable monitoring process for trust management, which increases resistance to trust-based attacks. In the monitoring process, as each data packet is sent to a next-hop, two vehicles observe the behavior of the next-hop in forwarding the packet, and the observations are then used to update the direct trust of the next-hop. The observations are additionally reported to RSUs, which gather the reports to update the indirect trust of the next-hop and provide recommendations to vehicles within their transmission range. In addition to indirect trust management, in RTRV, RSUs play an active role in the routing of data packets, which improves the routing performance. We simulated the proposed protocol in different scenarios with SUMO and OMNeT++ tools and then compared it with the TGRV protocol. The results of our analysis conclusively show that RTRV outperforms TGRV in terms of packet delivery ratio, end-to-end delay, and average hop count in both scenarios, with and without RSU. Specifically, in the RTRV without RSU scenario, when the percentage of malicious vehicles reaches 25%, RTRV achieves a 3.8% higher packet delivery ratio compared to TGRV. Furthermore, RTRV demonstrates significantly reduced end-to-end delay and average hop count, with values 0.14 and 0.11 times lower than TGRV, respectively. In addition, the cost and security analysis demonstrate that the proposed protocol has acceptable overheads in memory, communication, and computation and is also resistant to critical trust-based attacks.