Yes in 1864 the KKK was founded by former Confederate Soldiers who were Southern Democrats. Southern Democrats in the late 19th C and early 20th C were social Conservatives, highly religious and very prejudice against blacks. As, in their minds these people had been slaves and were in their minds only 3/4 persons; and thus they could not conceive that the Black race as equal to them. During the 20th Century these Southern Democrats took on the mantel of DixieCrat to distinguish themselves from the Northern Pro-Labor Democrats. It was also during the 20th C that Republicans also had Pro-Business advocates vs Progressive Social Liberals who advocated for equality for all people.
Up until the 1960s this was what the parties looked like and allowed a great deal of compromise between the Progressive Republicans and Pro-Labor Democrats with the Pro-Business Republicans, with a few concessions to the social conservative DixieCrats. Thus we have "In God we Trust" on our money and "One Nation under God" in the pledge. These were concessions to the religious right.
With the Civil Rights movement under Pres. Johnson there was a great deal of grumblings in the South and Pres. Johnson rightly predicted that the Democratic Party would lose the Southern vote. During the Nixon vs. Humphrey Presidential Campaign, one of the strategies was to capitalize on the disaffected Southern voters. It was called the Southern Strategy to gain the White Southern votes. It contributed to the electoral realignment of some Southern states to the Republican Party, but at the expense of losing more than 90 percent of black voters to the Democratic Party.
Today, the majority of White Southerners are Republican, many members of the KKK are Republicans, TeaPartiers (formerly known as DixieCrats) vote Republican, Social Conservatives vote Republican.
Democrats do not deny the history. History is history. But with the Civil Rights movement the Democrats showed the racists the door and the Republicans open their door to the racists. What was true for the Democrats in the 40s and 50s is now true for the Republicans. Not all Republicans are racists, but all racists vote Republican.
Look here.