Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I guess that by wildcard dns you mean *.dom1.com and *.dom2.com.
In that case why do you need the rewrite? You can setup the DocumentRoot for each vhost to be the desired one and add a ServerAlias for each, e.g for dom1.com:
<VirtualHost :80>
ServerName dom1.com
ServerAlias *.dom1.com
DocumentRoot /home/dom1.com/user1
...
</VirtualHost>
If that's not what you want to do, please elaborate.
yeah the wildcard way is right the main issue is i have 40 staff
i want to give 30 of them to do thier own web site just to show my boss i can do something
since that of 30 staff need 30 sub domain so i dont want to add VirtualHost for each
what i want is simple i create /home/dom1.com/staff1 so that staff will have http://staff1.dom1.com
also if the staff1 need to use second domain i will create /home/dom2.com/staff1 and this will go to http://staff1.dom2.com
then i will copy all the file given to me my self to thier own folder
this should work w/o restarting apache
You should have use something like staff1.domain.com, staff2.domain.com and so on, in which case mod_rewrite can be used.
If you want to have 30 domains (dom1.com, dom2.com ...), then you'll also need 30 vhosts
The rewrite code in the link you've posted works for subdomains. Meaning you have one domain configured as wildcard in apache and you use rewrite to serve different pages depending on the subdomain requested.
I've already told you that this can be done with mod_rewrite.
But, you don't want to use subdomains, rather than different domains (dom1.com, dom2.com etc) with the same hostname (staff1.dom1.com, staff1.dom2.com ...). This involves that apache must be configured to serve these domains (meaning several vhosts).
After thinking a bit more I think it's can be done using a little hack with the apache default vhost.
Assuming that staff1.domX.com points to the IP of your apache server, you'll need the following settings:
1. You don't define any vhost, so the request for staff1.domX.com will point to the default apache DocumentRoot
2. The DocumentRoot should be /home in your case
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.