Louis XIV held simple views regarding religion that dated back to Francis I - that the king controlled the Catholic Church and that the Church should do his biding. This brought Louis into clashes with various popes but they could not take on one of Europe's most powerful monarchs and Louis got his way regarding religion. To Louis, what was good for him was good for France - he saw no difference in the two and a Church that was subordinate to Louis was good for him.
Historically, France had experienced a great deal of turmoil regarding religion. The French Wars of Religion had torn France apart and had threatened the monarchy as an institution. Louis himself was a strong believer that the Roman Catholic Church was an essential tool within France of maintaining control over the people. Louis wanted religious uniformity enforced. This was especially true in the second part of his reign when he became more and more influenced by Jesuits. Louis viewed unorthodoxy as divisive and a possible/probable source of rebellion.
Louis used a similar policy in the Church as he did in political appointments. Louis ignored the Noblesse de Blood when it came to church appointments and appointed men from the Noblesse de Robe. Once again, these men came to rely on the king for their position and they backed him in full in the General Assembly of the Clergy. The Church backed Louis financially and took his side when he clashed with the pope in Rome - even over the vexed question of who actually controlled the Catholic Church in France - the king or the pope. This issue peaked when the king clashed with the pope over who controlled the land taken by France after the 1516 Concordat of Bologna - therefore, the terms of Bologna did not count for this territory. The Church in France sided with Louis and the 59 new dioceses officially gained the patronage of Louis - with the financial rewards this would bring - and further allowed him to extend his power outside of Paris.
During the bulk of his reign, Louis ordered the persecution of the Jansenists. Those who followed Jansenism believed in predestination - which was against what the Catholic Church preached. Predestination was also a fundamental part of the beliefs of the Calvinist faith. Jansenists were openly hostile to the Jesuits and as the Jesuits became more and more influential in the life of Louis, the king tolerated them less and less. Two convents near Paris were known to be hot-beds of Jansenism (the Port-Royal and the Port-Royal des Champs). In 1661, Louis declared that five fundamental beliefs of the Jansenists were heretical. In the same year he expelled the novices at the two convents. In 1664, the chief nuns at both convents were arrested and the convents were put under a military guard. In later years, the nuns who remained at both convents were forcibly moved to other convents that were known to be anti-Jansenist. In 1710, Louis ordered the destruction of the convent at Port-Royal des Champs. In 1713, Louis asked the pope to introduce the Papal Bull 'Unigenitus' which condemned all Jansenist beliefs. This was the price to be paid by anybody/institution that Louis believed was a threat to himself or France - though Louis saw no difference between the two.
Louis also persecuted a movement known as Quietism. This was a mystical movement that originated in Spain and Italy. In France it was led by Madame de Guynon. The movement put its emphasis on a total love of God which made ceremonies and religious works unnecessary. This meant that it could exist independent of the Catholic Church and this Louis could not accept. De Guynon was arrested and imprisoned and in 1699, Louis pressured the pope into condemning the movement as "erroneous" as opposed to heretical.
Louis was less tolerant of the Huguenots. When Louis became king in 1643, there may have been as many as 2 million Huguenots in France. Therefore, in simple numeric terms they represented a far greater threat to French stability than the Jansenists did and previous French history had shown that the Huguenots could be less than loyal to the crown. However, in the reign of Louis, the Huguenots had been a loyal and industrious group that had done a great deal for France with regards to modernising her economy. In every sense they were a benefit to France - so why did Louis decide to persecute them?
The Assembly of Clergy had been pressing him for a number of years to take action against the 'heretics'. In his later life, Louis also came under the influence of Madame de Maintenon who was a fervent Catholic and had Jesuit confessors who soon had the ear of the king. Both groups wanted action taken against the Huguenots.
To start with Louis embarked on a policy to bring the Huguenots back to the Catholic Church. The terms of the Edict of Nantes were strictly enforced (for decades they had not been) and decrees were issued which made it more and more difficult for a Huguenot to get a job in any of the professions. This effectively excluded them from government posts. Those who did revert back to Catholicism, were given cash payments in an effort to attract others to do the same. This policy had only a limited impact. In some areas, the Huguenots had troops billeted on them - the 'deal' being that they would be removed if those in that region reverted back to the Church. Finally in October 1685, Louis revoked the Edict of Nantes and introduced the Edict of Fontainebleau. This made Protestantism illegal. As a result, 200,000 Huguenots fled the country. Their loss was badly felt as many of these people had a great deal to offer the economy of France. They took their talents to Brandenburg-Prussia, the United Provinces or Britain. Such an influx of refugees did a great deal to anger the respective governments of those countries that took in the refugees. The governments were not angry with the refugees - but with Louis. To them, what he did to the Huguenots showed what a tyrant he had become and what a potential danger he was to Europe. Ironically, a policy that was meant to bring more stability to France, brought increased instability to Europe with powerful nations siding with one another against Louis.