Fix an issue that assumes the project is installed in the root.

`$_SERVER['HTTP_HOST']` fails when the project is installed in subfolder, e.g. `http://rooturl.tld/project/dir/`. Changing this to `$_SERVER['HTTP_HOST'] . dirname( $_SERVER['PHP_SELF'] )` fixes the issue.