History of Chefchaouen
Chefchaouen was founded in Mulay Ali Ben Rachid with the purpose of restraining the Portuguese advancement and influence in Morocco, and as a base for attacks into Ceuta. Ben Rachid constructed the Kasbah to aid in the defense. The city regularly fought off attacks from the Portuguese, various Berber tribes and Spaniards.
The name of the city, means "Look at the Peaks", in reference to the surrounding mountains.
During the 15th to 17th century the city grew and prospered with the arrival of both Muslims and Jews who had been expelled from Spain in the late 15th century. These refugees brought with them the practice of whitewashing houses, creating tiny balconies, tiled roofs and patios, and a center of the patio planted citrus tree, all which aids to the strong Spanish influence in the city. The Jewish immigrants brought with the pale-blue wash that is the trademark of the city now.
Previous to the Jews arrival windows and doors had been painted green, the traditional Muslim color.
Until 1920 the city was closed to all Christians. It remained closed until Spain occupied the city in 1920.
A few memorable tourist encounters during this closed period included the French explorer Charles Foucauld, who came disguised as a rabbi, the English journalist Walter Harris who came disguised as a Jew and later William Summers, an American missionary who was poisoned and died in the city.
Lonely Planet Morocco by Anthony Ham and Allison Bing
For More Info:
The best collection of tips on Chefchaouen that I have seen is on the Virtual Tourist website
Great Video on Chefchaouen in Arabic
Flickr also has a great slideshow on Chefchaouen