I've been trying to make the following thing work for hours, with no luck:
I have a vps hosting at digitalocean running ubuntu and xampp, and I have multiple domains pointing to the same ip address.
What I want to do is load files from different subdirectories for different domains.
So when I enter domain1.com into the browser, it loads the files from /htdocs/domain1/, and domain2.com from /htdocs/domain2/.
I've found several examples about this, but all of them had the same problem when I tried accessing subdirectories like this: domain1.com/test, they all redirected me to domain1.com/domain1/test, and I do not want to see the middle part domain1 in the url.
Is it even possible?
I've tried all the answers scattered around the internet searching for "multiple domains on one hosting htaccess", and "htaccess hide middle part of url".
Thank you for reading.
Assuming you're using apache as webserver:
define a VirtualHost for each domain, or host in domain. Give each VirtualHost as ServerName the host- or domain name you want to associate with it.
specify a different DocumentRoot for each VirtualHost. The DocumentRoot is the path to the actual files.
add the hostnames you want te be able to access the web files under to your DNS zone.
When done correctly, you will be able to access the web presence associated with each host- or domain name, without the need to enter any subdirectories in the URL, nor will their names show.