Virtualhosts in local environement

Sometimes a single local domain “localhost” is not enough if we develop more projects. Usually we just use folders for different projects, but woldn’t local domains be better? Some php scripts are not made to run from a subfolder and have problems with that. Here is the solution.