default-directory does not do what you seem to think. C-h v
default-directory
default-directory is a variable defined in `buffer.c'.
Its value is "/"
Local in buffer stackoverflow.com/questions/14914353; global value is nil
Automatically becomes buffer-local when set in any fashion.
This variable is safe as a file local variable if its value
satisfies the predicate `stringp'.
Documentation:
Name of default directory of current buffer. Should end with slash.
To interactively change the default directory, use command `cd'.
It's a buffer-local (i.e. buffer specific) variable, meaning its value is
different depending on which buffer is currently active. So when you think you've set it to
"/var/www", you are simply visiting a file already in that directory.
If you want to open a file from "/var/www", you need to make your own command
that binds "/var/www" to default-directory.