Shimla was annexed by the British in 1819 after the Gurkha War. At that time it was known for the temple of Hindu Goddess Shyamala Devi . The Scottish civil servant Charles Pratt Kennedy built the first British summer home in the town in 1822.
Lord Amherst, the Governor-General of Bengal from 1823 to 1828, set up a summer camp here in 1827, when there was only one cottage in the town, and only 'half a dozen' when he left that year. There were more than a hundred within ten years.
Shimla, or Simla as it was called until recently, caught the eye of Lord William Bentinck, the Governor-General of Bengal from 1828 (later of India , when the title was created in 1833) to 1835. In a letter to Colonel Churchill in 1832 he wrote
“Simla is only four days march from Loodianah (Ludhiana ), is easy of access, and proves a very agreeable refuge from the burning plains of Hindoostaun (Hindustan ).”
One of his successors, Sir John Lawrence, Viceroy of India 1864–1869, decided to take the trouble of moving the administration twice a year between Calcutta and a separate centre over 1,000 miles away, despite the fact that it was difficult to reach. Lord Lytton, Viceroy 1876 -1880 made efforts to plan the town from 1876, when he first stayed in a rented house, but began plans for a Viceregal Lodge, later built on Observatory Hill. A fire cleared much of the area where the native Indian population lived (the "Upper Bazaar"), and the planning of the eastern end to become the centre of the European town forced these to live in the Middle and Lower Bazaars on the lower terraces descending the steep slopes from the Ridge. The Upper Bazaar was cleared for a Town Hall, with many facilities such as library and theatre, as well as offices - for police and military volunteers as well as municipal administration.
During the 'Hot Weather', Simla was also the Headquarters of the Commander-in-Chief of the Indian Army and many Departments of the Government, as well as being the summer capital of the regional Government of the Punjab . They were joined by many of the British wives and daughters of the men who remained on the plains. Together these formed Simla Society, which, according to Charles Allen, "was as close as British India ever came to having an upper crust." This may have been helped by the fact that it was very expensive, having an ideal climate and thus being desirable, as well as having limited accommodation. British soldiers, merchants, and civil servants moved here each year to escape from the heat during summer in the Indo-Gangetic plain. The presence of many bachelors and unattached men, as well as the many women passing the hot weather there, gave Simla a reputation for adultery, and at least gossip about adultery: as Rudyard Kipling said in a letter cited by Allen, it had a reputation for "frivolity, gossip and intrigue".
The Kalka-Shimla railway line, constructed in 1906, added to Shimla's accessibility and popularity. The railway route from Kalka to Shimla, with more than 806 Bridges and 103 tunnels, was touted as an engineering feat and came to be known as the "British Jewel of the Orient". In 2008, it became part of the UNESCO World Heritage Site, Mountain railways of India . Not only that, there was a significant Muslim population in the region before the partition of British India . In addition, Shimla was the capital of the undivided state of Punjab in 1871, and remained so until the construction of the new city of Chandigarh (the present-day capital of Punjab ). Upon the formation of the state of Himachal Pradesh in 1971, Shimla was named its capital.
Pre-independence structures still dot Shimla; buildings such as the Viceregal Lodge, Auckland House, Gorton Castle , Peterhoff house, and Gaiety Theatre are reminders of British rule in India . British Simla extended about a mile and a half along the ridge between Jakhoo Hill and Prospect Hill. The central spine was The Mall, which ran along the length of the ridge, with a Mall Extension southwards, closed to all carriages except those of the Viceroy and his wife.