I have modified the code and am close, just one small problem.

What I have is this directory structure:

public_html
subDirA (This is where the website for example.com resides and is internally rewritten to public_html. The user never sees subDirA.

subDirB (This is actually the new subdomain. Internally it looks like a subdirectory under public_html. In the code below, the subdomain displays...