It is a huge subject, but I would start with the apache documentation in relation to such topics as httpd.conf, aliases and virtual hosts. With apache, each filetype will reference different relative paths, by default, subdirectories of the default directory configured for your webserver - the actual location your file refers should be consciously configured for the webserver and then the permission for the relevant directory controlled.