Add document_root check to home_dir variable creation.