<map lat='34.025278' lng='-6.836111' zoom='12' view='5' float='right'/>
Rabat is the capital of Morocco.
Long Distance Ride into Mauritania
If you are heading into Mauritania, the mauretanian 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 mauretanian border afterwards, which is still a 2000km journey away. With a bit of luck, you can even find a driver heading for Senegal and Gambia here.
Concerning your own visa, regulations change all the time and official internet pages are unreliable. Visa's might be issued at the border to Mauretania aswell, but several times in the past, Rabat was the only place in Morocco to pick up a mauretanian visa. For most reliable information, phone the mauretanian 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.
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.
CRCulver isn't sure which road the above advice is for, but he recommends getting onto the motorway. The national road between Rabat and Casablanca passes through endless suburbs, and you'll find it tiring to avoid all the taxis. Standing at a motorway entrance with a sign, however, should get you a direct lift at least to Casablanca.
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.
Option 2: 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.