I would like to use virtual hosting to redirect each domain I have to a folder on my server.
So I changed the DNS of my domains in order to be redirected to my server, and that's working.
Now I want to set the virtualhost config to reach the relevant folder for all my domains.
The default configuration of my Gentoo is:
And I've added just after that:
ServerEnvironment apache apache
But when I want to reach "mysite", I'm always redirected to the root of my server (that is to say, to /home/ovh/www instead of /home/ovh/www/mysite)
That's as if what I added couldn't be read... I just don't understand why and what I should do to get it working.
Can you help me ?
Thanks a lot.
PS : I apologize for my poor english... I'm french.
you need "name based virtual hosts", google that or search this forum. I know I have helped on several topics about that in this forum, google has good help also.
I searched google and this forum (all threads having "virtual host" or "virtualhost" in the title), and I found many threads about the issue I deal with.
I found many threads with no answer like this one and some others with many answers but not explaining how to fix the problem (like this one).
But absolutly none of them explain what to do if your configuration always chose the default virtual host (the first), instead of the one matching to the hostname typed.
So the issue is that when i type 'mysite.com' in the URL bar, I'm driven to the path of my default virtual host instead of the path of the virtual host with the line
If someone having already dealt with that could help, I'm sure that it would help more than one person.
Thanks a lot
so did you read my post. i didn't say search for virtual host, I said search for name based virtual hosts (its different, thats why I said it)
Originally Posted by Gorion
name based virtual host - Google Search
I did it too... That was my redirection that was not set correctly. I had not chosen to redirect the hostname by changing DNS (there was an other choice in my OVH manager).
Originally Posted by jledhead
So the configuration above was OK.. So if you're reading this post and if you don't understand why your configuration doesn't redirect your websites in your directories proprely (and if you have checked that your configuration files are correct), have a look to your DNS configuration ! Just check that the target of the field "A" is the IP adress of the server you want to redirect hostnames to.
For OVH users : Be careful to change the DNS of your hostnames, and not to chose the option "Redirect website", for this one will just build a page with a frame containing the home page of the root of your server.
Once again, I apologize for my 'frenglish'.
This is the Virtual-Domain-Conf for my Home-Server (Windows, XAMPP):
On Windows add also in %WINDOWS%\system32\drivers\etc\hosts the following:
# Deninition of Virtual-Domain 1 (www.domain.tst):
Options Indexes FollowSymLinks Includes ExecCGI
Allow from all
# Deninition of Virtual-Domain 2 (www.domain2.tst):
... (same as above with dofferent domain-name
Since this is a Home-Server i don't looked at security and several options in the configuration of Apache.