[Cialug] Virtual hosts in Apache

Barry Von Ahsen barry at vonahsen.com
Fri Jun 1 17:13:36 CDT 2007


Tim Wilson wrote:
> On 6/1/07, Chris Freeman <cwfreeman at gmail.com> wrote:
>>
>>
>>
>> On 6/1/07, David Champion <dchampion at visionary.com> wrote:
>> >
>> > ...
>> > Doing a search / replace on the IP isn't that hard (at least using joe.
>> > Doing it in vi, well, that's another story).
>> >
>> > -dc
>>
>>
>> <off-topic flame="on" why="because I can" >
>> While doing it in joe might not be hard, doing it in vi is downright 
>> easy.
>> And fun. ;-)
>> </off-topic>
>>
>>
>>
>> _______________________________________________
>> Cialug mailing list
>> Cialug at cialug.org
>> http://cialug.org/mailman/listinfo/cialug
>>
>>
> Ignoring the potential flame war (FTR, I use emacs, and it is very easy), I
> tried it with IP addresses and with *.  With *, I get warnings when
> restarting httpd.  With IP addresses (or with *), If I go to
> foobar.domain1.com (port 80), I get what I would expect from 
> foo.domain1.com.
> Is there a way to display an error when someone goes to
> foobar.domain1.comon port 80, but display the page when they go to
> port 8080?  I did add
> NameVirtualHost lines with the appropriate ports.
> 

you could do
<VirtualHost foobarip:80>
	ServerName foobar.domain1.com
	Redirect / http://foobar.domain1.com:8080/
</VirtualHost>

to redirect them or

	RedirectMatch permanent (.*) http://foobar.domain1.com:8080$1

to redirect them to what they requested

-barry


More information about the Cialug mailing list