I can answer at least partially, for Nixon, as that was a major part of my graduate thesis.
In the 1964 presidential elections Republicans suffered an absolutely crushing electoral defeat. Barry Goldwater, an arch-conservative, won only five states: his home state of Arizona (by less than 5,000 votes) and the Deep South states Louisiana, Mississippi, Alabama, Georgia and South Carolina. And these states are important. The Deep South was traditionally a Democratic bulwark, represented by a faction known as the Dixiecrats. The Dixiecrats were a faction that favoured states' rights, to the extent that it allowed them to maintain segregation and Jim Crow. Ever since World War II they were at odds with northern Democrats over Civil Rights. Executive Order 8802, which forced companies working for government contracts to end racial discrimination, was a huge bone of contention for them. At the 1948 Democratic National Convention both factions clashed, with the Dixiecrats dramatically walking out of the convention. That year they ran a third party campaign as the Democratic States' Rights Party. They won four states (Louisiana, Mississippi, Alabama and Georgia). After the 1948 elections compromises were reached that reunified the Democratic party, to some extent. The Dixiecrats kept pushing for maintaining segregation under the guise of states' rights, as evident in documents such as Strom Thurmond's Southern Manifesto.
Fast forward to 1968. The Civil Rights Movement had been a decisive victory for the northern Democrats, which also meant that the Dixiecrats were pretty much done with the Democratic party. Goldwater's 1964 victory showed that the Deep South states could potentially be won for the Republican party. However, Goldwater's rhetoric, while resonating with the Deep South states, was deeply divisive. One infamous example that often gets quoted is Goldwater's statement that the United States would be better off if 'the entire eastern seaboard were cut off and cast out to sea,' a statement which the Democrats seized on with a campaign ad. Nixon needed a way to appeal to the Southern states in a way that wouldn't alienate the rest of the country.
Enter Kevin Phillips. He was an amateur statistician who as a hobby charted shifts in population following World War II. The expansion of military production created shifts in demographics that he wanted to seize on. In order to do so the Nixon campaign linked the Democratic Party to what were seen as excesses of the Civil Rights movement and Johnson's Great Society. This can be seen in articles such as What Has Happened to America?, which Nixon wrote for Reader's Digest. He not only reached out to a larger audience by choosing this platform, but he also framed his message in a way that he hadn't done in 1960. He explicitly appealed to moral arguments and deliberately trivialized the issues that had led to the urban riots of the 1960s. Basically the Nixon campaign hinged on presenting the idea that the Democrats had failed to protect America's interests either at home or abroad. Abroad he could argue from experience, as foreign policy was always something he had been very strong on, as evidenced by the Kitchen Debate and the way he used his 'Wilderness Years' (the period between failing to win the 1962 California gubernatorial elections and his 1968 candidacy) to strengthen his ties with foreign leaders.
Appeals to morality gave Nixon a way to speak on domestic issues in a way that he hadn't been able to in 1960. In this he was helped by the growing civil unrest that marked the second half of the sixties, especially in terms of rioting and rising crime rates. The 1965 Watts Riots in Los Angeles had the dubious honour of being the first riots to be filmed from a news helicopter, with footage being broadcast nationally. This had a huge impact on public opinion. In general, a breaking down of morals was a narrative that existed prior to the 1968 campaign as media figures sought to explain rising crime rates and unrest, but it was Nixon who truly seized on it. He was aided in this by Billy Graham, an incredibly popular televangelist who was known for hosting tens of thousands of people at rallies he called Crusades, which were often broadcast on both radio and television. Graham openly supported Nixon, the first time he had endorsed a candidate, which gave Nixon the backing he needed to present himself as the moral candidate.
Now, bringing it back to the north vs. south narrative, the Democrats weren't the only party. Nixon's main competition within the party came from Nelson Rockefeller, who represented the more liberal, east coast wing of the Republican party. The Nixon ascendancy pretty much ended that group as a relevant faction within the Republican party. Rockefeller was Vice President under Ford, but would never be truly relevant again. Nixon essentially traded the eastern seaboard for the Deep South, based on the fact that Civil Rights and Great Society legislation had pretty much won the major urban areas there for the Democrats permanently. Kevin Phillips' ideas were basically to shift Republican focus from these urban areas to suburbs and the Sun Belt, basically the South from Florida to California. These areas had seen a lot of white middle class migration since World War II, and it was these voters who Nixon sought to appeal to by presenting a more moral rhetoric that sought to capitalize on backlash against the Civil Rights movement and the Great Society in a way that wouldn't make the general public consider him racist. He wanted to avoid Goldwater's fate in 1964.
So to summarize those rambling and hurriedly written paragraphs above:
Now obviously Nixon actually didn't win the Deep South states in 1968. Those states went to Alabama governor George Wallace, famous champion of segregation with his stand in the schoolhouse door. He, like Thurmond in 1948, ran a third party campaign that was aimed at trying to make sure that neither the Republicans nor the Democrats would get a majority of electoral seats, which would give the Dixiecrats the leverage to force concessions on segregation and Jim Crow from whatever candidate they would pledge their electors to. But the 1968 campaign did mark a notable shift to the right for the Republican party anyway. The liberal faction of the party was pretty much finished, and the focus was on new, more conservative constituencies. Evangelical Christianity had become a major part of the party's rhetoric. And Dixiecrat politicians switched their party from Democrat to Republican in fairly large numbers during the 1960s and 1970s, even before the 1968 Nixon campaign. The Nixon campaign did make the decision to jump ship easier however.
Sources, other than the stuff already linked in the text: