Rabat is the capital of Morocco.
East toward Meknes, Fes (A2)
To get to Fes, go to the Bab el-Bouiba (one of the gates to leave the Medina) and follow the road towards the shell petrol station you can see down the lane. Across the street from the Medina there's a bus stop, go over there and ask somebody which bus to take to the road to Fes (it's one of the ones waiting there). You'll get out at a petrol station, so you can chose to ask around there or walk down the road a couple of hundred meters where there's ample space for cars to pull over, and start hitching.
South towards Casablanca, Marrakech
Take bus no. 4 or 32 from Rabat's Bab el Had to a stop called Guich Lwdaya (about 45 minutes; 3,60 dirham). From there walk in the direction the bus has come from for 100 meters or so and turn left to hitch. Have a sign.
To go to the start of the motorway you can take the tram line 1 to the final stop "Madinat al irfane", follow the road to the third roundabout and then turn right. You will come to a bridge wich crosses the national road, after this you can underpass the bridge and follow the national road (there is a sidewalk) until the road divides into the Motorway and the national road. There is a roundabout witch is a very good for hitchhiking. If you have a look at the road signs it is very easy to find but it is about 3,5 km of walking from the tram station.
North towards Tanger
Take bus no. 18 from Bab el Had to a stop called Hay Senaai. Walk back to the roundabout and hitch, best with a sign.
FInd your way towards the airport (Buses 1 and 2 go close), and you'll be on a big road leading out of Rabat / Salé towards the motorway (Avenue Hassan II). The same road also leads to the motorway towards Meknes / Fes. You can hitch this road or walk for a few kilometers until the onramp onto the motorway to Tanger. Here is a good spot to hitch.
Long Distance Ride into Mauritania
If you are heading into Mauritania, the mauritanian embassy is where most people pick up their visa. Thus, on every work day there is a crowd of people picking up their visa and a bunch of them will hit the road towards the mauritanian border afterwards, which is still a 2000km journey away. With a bit of luck, you can even find a driver heading for Senegal and the Gambia here.
Visa regulations and prices change all the time and official internet pages are unreliable. Visas might be issued at the border to Mauretania, but several times in the past, Rabat was the only place in Morocco to pick up a mauritanian visa. For most reliable information, phone the mauritanian embassy in Rabat. In February 2018 the Visa price at the embassy was around 70€ and could be picked up on the next work day.
Nomadwiki & Trashwiki
Check Nomadwiki for info on accommodation, showers etc. or Trashwiki for dumpsters...and share your wisdom :)