I have two sites which runs independently on my VPS, let's call them site1 and site2.
They are respectively located at /var/www/html/site1 and /var/www/html/site2
I don't have a domain name yet but I can acces my site using server IP, let's say its adress is 8.8.8.8
I currently have two separate apache configuration file for each site.
Both sites are configured as follow, only DocumentRoot
and the second Directory
block differs.
<VirtualHost *:80>
ServerName 8.8.8.8
DocumentRoot /var/www/html/site
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html/site>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I can acces both my site by enabling one and disabling the other one.
At first I wanted to have a separated subdomain http://site2.8.8.8.8/* but since I don't have a DNS record yet I can't really achieve it without modifying the local hosts file on every computer which wants to acces website.
So I though a better solution could be to have site1 running on http://8.8.8.8/* and site2 running on http://8.8.8.8/site2/*
Apparently it can be done using RewriteCond
but I can't find a way to make it work.
Is my aim really achievable without having DNS records ?
Otherwise couldn't that be achieved by running site2 on another port like 8080 and redirecting to this port ?