Van Gaal was sacked by Bayern in April with his side fourth in the Bundesliga, as only the top three from the German league qualify for the Champions League, but is still under contract in Munich until next June.
He was last week controversially appointed as Ajax's general director from July 2012, and Ribery took a swipe at the Dutchman when he heard the news.
"I have heard and read that everyone wants to get out of Ajax when he comes," Ribery told SID, an AFP subsidiary, on Wednesday after scoring twice in Bayern's 3-1 win over Villarreal in the Champions League.
"That's a bit weird, but I couldn't care less.
"He is far away, and I am now very happy."
Ribery joined Bayern in 2007, but endured a difficult two years under Van Gaal, who was Munich coach from 2009 until earlier this year.
Although Bayern won the league and cup double in Van Gaal's first season, reaching the Champions League final in the process, Ribery describes his time under the Dutchman as a 'difficult period'.
He has repeatedly said he is far happier working under Jupp Heynckes, who took over as Bayern boss at the start of the season and has steered Munich to top of the Bundesliga.