Commercial shared server so no access to config. The only things I have in my htaccess start off my custom PHP.ini
Not a problem, so long as you're allowed to maintain your own htaccess and make it do the various things an htaccess can do. Somewhere in your host's fine print you will find the details.
So how does the redirecting work when you type mysite.com, and not have to type mysite.com/index.php to enter any site?
That part is simple. Well, conceptually simple. The config file includes a list of possible index-file names:
index.html
index.htm
index.php
The exact list depends on the config file.
When a request comes in for a directory, several things happen.
What follows is the default behavior. Some things can be overridden by explicit rules in htaccess files. When I say "Apache", I mean either the Apache core or a module whose job is to deal with some specific aspect of the request.
First, if the request is for a "naked" name (no extension or slash), Apache checks whether there is a directory by that name. If yes, Apache sticks on a slash. This is officially called the Directory Slash Redirect. If no, you are handed an immediate 404. Generally we think of 404s as being for nonexistent
pages, but they are also used for nonexistent
directories.
Next, Apache looks inside the directory to see if there exist files with any of the names in its "possible index file" list. If yes, you're taken to that file. If no, Apache checks whether auto-indexing is enabled for this directory. If yes, Apache runs up an index on the fly. If no, you get a 403 error. Yes, the very same 403 that evil robots get.
The point I'm trying to stress is, HTTP_HOST is fine when this happens. It only seems to 'reset' when the URL points to a directory another level down.
Who is reading the HTTP_HOST value? Your php file, or the .htaccess? Going back to the original post:
mysite.com/start and myothersite.com/start are always seen as mysite.com/start/index.php
This cannot happen by itself. Something is redirecting myothersite.com/start to mysite.com/start and from there, as spelled out above, it ends up in mysite.com/start/index.php. Redirects can be issued by php, or they can originate in htaccess. In fact that seems to be exactly what you said:
mysite.com and myothersite.com begin at mysite.com/index.php and I can change site settings depending on HTTP_HOST (which is either set to mysite.com or myothersite.com)
So the HTTP_HOST is getting read before the redirect to mysite.com
Did you write all your own php, or is some of it boilerplate that you inherited or copy-and-pasted? That is, do you know what every single line of your php does? (Say Yes, because I don't speak php ;))
____
OK, all of that was preliminary. I'm still trying to figure out what a human user sees when they go to your site. Is it the user's choice which domain they ask for, or does your php read some information and send them to the right place? Can they switch from one domain to another?
What do they see in the address bar? That's assuming I have understood correctly that you have more than one domain name. If so, there has to be some kind of DNS setup. Otherwise, people would never reach you in the first place. If there were no php scripts and no htaccess, where would the different domain requests end up?