Forum Moderators: phranque

Message Too Old, No Replies

Redirect from specific ip address with httpd-vhosts.conf

         

soolmaan

10:03 am on Sep 20, 2010 (gmt 0)

10+ Year Member



Hi Everyone,

I have a virtual host configured in httpd-vhosts.conf and I want from one ip-address to be redirected to a different virtual host. Is this possible? If yes, how would I do this?

Thanks!

yaba

11:48 am on Sep 20, 2010 (gmt 0)

10+ Year Member



yes it is.
Assuming apache2 instalation do this:

Create a new file "virtual.conf" at /etc/apache2/conf.d
with NameVirtualHost *

now,
at sites-available
create each virtualhost
something like:

<VirtualHost *>
ServerAdmin your_email
ServerName your_domain1
ServerAlias your_domain1

DocumentRoot "/var/www/domain1"
<Directory "/var/www/domain1">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

and other
<VirtualHost *>
ServerAdmin your_email
ServerName your_domain2
ServerAlias your_domain2

DocumentRoot "/var/www/domain2"
<Directory "/var/www/domain2">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

However... i'm having an issue with this, but i'll explain in a new post