Forum Moderators: phranque

Message Too Old, No Replies

Newbie Virtual Hosts problem

         

gezginrocker

4:15 pm on Feb 14, 2012 (gmt 0)

10+ Year Member



hello,

I have installed Scientific linux and having trouble with virtual hosts.

I set my hostname as "lunar.example.com"

and those are my apache settings:

----------------------------------------------------------------------

ServerName lunar.example.com

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /home/can/public_html/example
ServerName example.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/can/public_html/example
ServerName example.com
</VirtualHost>
----------------------------------------------------------------------

www.example.com is working fine.

but both www.example.com/example.com are redirecting to www.example.com

what am I doing wrong here?

thanks a lot

[edited by: tedster at 5:46 pm (utc) on Feb 14, 2012]
[edit reason] switch to example.com [/edit]

phranque

10:50 am on Feb 16, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, gezginrocker!

to start with, you are required to use a unique value for the ServerName directives.
i.e. one of them needs to be:
ServerName www.example.com

(it's possible that the edit is confusing the meaning of your original post.)

once you get that figured out, i don't see anything in what you posted that looks like a redirect directive, so you have to find out where than is happening.
i assume by "redirecting to www.example.com" you are implying a 301/302 status code response.

gezginrocker

11:52 am on Feb 16, 2012 (gmt 0)

10+ Year Member



I changed the virtual hosts lke this and they are working fine now, thank you very much.

<VirtualHost *:80>
DocumentRoot "/home/can/public_html/taylandgezi"
ServerName www.taylandgezirehberi.com
ServerAlias taylandgezirehberi.com
</VirtualHost>