Apache Virtual Hosts Problem
hello,
I have installed Scientific linux and having trouble with virtual hosts. I set my hostname as "lunar.taylandgezirehberi.com" and those are my apache settings: ------------------------------------------------------------------ ServerName lunar.taylandgezirehberi.com NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /home/can/public_html/taylandgezi ServerName taylandgezirehberi.com </VirtualHost> <VirtualHost *:80> DocumentRoot /home/can/public_html/taylandvilla ServerName taylandvilla.com </VirtualHost> ------------------------------------------------------------------ www.taylandgezirehberi.com is working fine. but both www.taylandvilla.com/taylandvilla.com are redirecting to www.taylandgezirehberi.com what am I doing wrong here? |
Did you add some lines in /etc/hosts like
Code:
<your ip> taylandgezirehberi.com Sorry, just realized you want these sites accessible from internet :/ Maybe see DNS settings then |
found a solution, I added a second virtual host with redirect, now it seems to be working fine.
<VirtualHost *:80> DocumentRoot /home/can/public_html/taylandvilla ServerName www.taylandvilla.com </VirtualHost> <VirtualHost *:80> DocumentRoot /home/can/public_html/taylandvilla ServerName taylandvilla.com redirect permanent / http://www.taylandvilla.com/ </VirtualHost> |
For this sort of redirect, there is also ServerAlias directive
|
is it better to use ServerAlias directive?
if so, can you give me an example usage please? thanks |
Same effect as above but with just one VirtualHost directive
Code:
<VirtualHost *:80> |
thank you very much Cedrik, it works perfectly. :)
have a nice day... |
All times are GMT -5. The time now is 06:42 PM. |