I have a situation where I want to direct this
url : mypage.example.com
to: example.com/mypage/

BUT if the directory does not exist, then I want to direct it
to: example.com/info.php?pg=mypage

I don't think I can put if statements in the .htaccess file

but how would I do this in php script ?

Any suggestions ?