imgflip.com/i/3ml64t
In 1948, there was a splinter group from the Democratic Party that called itself the "States' Rights Democrats" (those first two words should sound familiar to current Republicans). This group wasn't *just* about protecting segregation, but it was the main policy split from Truman (the D incumbent). They ran Strom Thurmond as their presidential candidate, and won the electoral votes from South Carolina, Alabama, Mississippi, and Louisiana (plus one single electoral vote from Tennessee). From then on, every time a Democratic president won, the South voted more and more Republican (with the exception of 1976, of course...Carter was Southern, albeit a supporter of civil rights, and Nixon kind of killed Republicans' chances by being Nixon) in large part because the Democratic Party was a group that no longer tolerated opponents to civil rights.
The Republican Party, on the other hand, has never been *openly* racist. The switch for Republicans hasn't been in their platform, but rather in how they interpret their stances. Rs have embraced "states' rights" as their own, in opposition to a large centralized Federal government; in and of itself, this is not racist, but racists all strongly support the right of states to make their own choices (see: "the War of Northern Aggression" is so termed because the Federal government had the audacity to dictate that people in Southern states couldn't own other people, regardless of what the state's law was). By attaching conservatism to states' rights, Goldwater secured the four states above for Republicans in 1964. George Wallace, with his third party run in 1968 that stole the final Solid South stronghold of Arkansas, cemented the departure of segregationists from the Democratic Party in favor of the Republicans.
Add to this the curious switch that happened surrounding what conservatism in defense spending is (from Harding's pared-down spending intended to be limited to protecting US borders, to Reagan's hyper-inflated spending to combat Communism literally everywhere), and you've got an ideological shift in the Republican Party.