Moving the Document Root with mod_rewrite

If you host a website with BlueHost, you don’t get to choose the directory for your domain’s document root. Your primary domain (i.e., the one you signed up with) will have a document root of ~/public_html/, and any additional domains will be sub-directories of that (e.g., ~/public_html/xplus3/).

That doesn’t give you much flexibility if you want to do something crazy like keep your sites organized. I would much rather see my primary domain’s document root at ~/public_html/, so I can keep subdomains in directories that aren’t also subdirectories of the primary domain’s document root, not to mention keeping entirely different domains out of the directory tree for the primary domain.

My problem seems to be common enough that BlueHost gives you some basic instructions for using mod_rewrite to achieve essentially the same thing. Their formula is slightly lacking, though.
Continue reading “Moving the Document Root with mod_rewrite”