I have tried using Mod Rewrite via .htaccess to solve this issue to no avail.
So I will ask if it can be accomplished via Vhosts.
This is CentOS7 using Apache.
I have a domain, call it mydomain.com. It is sitting in (docroot)
Users are created dynamically within a folder of (docroot) called Users. So for example, user 'xxx' would sit in the folder (docroot)/Users/xxx, and user 'yyy' would sit in (docroot)/yyy , and so it goes...
What I am trying to do, so far to no avail, is to find a way to direct subdomain traffic to xxx.mydomain.com and serve the contents of (docroot)/Users/xxx , or yyy.mydomain.com serves (docroot)/Users/yyy etc, etc.
Where in comparison, if I direct traffic to mydomain.com simply to (docroot)
So mydomain.com points to /var/www/html and xxx.mydomain.com should point to /var/www/html/Users/xxx
The problem is if I use .htaccess it wants to change xxx.mydomain.com to mydomain.com/Users/subdomain. This is not what I am looking for.
It needs to retain the xxx.mydomain.com , so no rewriting of the url , while serving the appropriate directory, which is /var/www/html/Users/xxx
Any help would be appreciated. Any clarification can be given
I have tried modifying the .htaccess file to no end
So far I have tried this as my conf file but to no end.
<VirtualHost *:80>
ServerName dev.mydomain.com
ServerAlias dev.mydomain.com
DocumentRoot /var/www/html/mydocroot
</VirtualHost>
<VirtualHost *.80>
ServerAlias *.dev.mydomain.com
VirtualDocumentRoot /var/www/html/mydocroot/Users/%0
</VirtualHost>
I am very curious as to what I am doing wrong