Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Oct 20, 2012 2:20 am 
Offline
Senior Member

Joined: Fri Feb 11, 2011 1:36 pm
Posts: 118
I have 2 sites hosted, but they behave in diferent ways with "www" and without "www":

"http://mainsite.com" gives "It Works!"
"www.mainsite.com" works correctly.

"http://secondary.com" works correctly
"www.secondary.com" gives "It Works!"

"mainsite.com" is also my hostname, maybe it´s something to do with that...
I´m running Ubuntu and Apache.
Thanks for any help.


Top
   
PostPosted: Sat Oct 20, 2012 2:32 am 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
Yes, lets all play twenty questions because you want to hide YOUR PUBLIC WEBSITES.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Sat Oct 20, 2012 6:53 am 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
vonskippy wrote:
...you want to hide YOUR PUBLIC WEBSITES.


The names seemed chosen to more clearly illustrate the problem rather than hide anything.

James


Top
   
PostPosted: Sat Oct 20, 2012 7:14 am 
Offline
Junior Member

Joined: Sat Feb 18, 2012 12:26 pm
Posts: 24
What webserver are you using?

If Apache, how did you configure ServerName in the VirtualHost sections?

To treat both as distinct websites out of the same instance, set one to be the servername and then alias the other:
Code:
<VirtualHost *:80>
    ServerName www.mainsite.com
    ServerAlias mainsite.com
   ...rest of the config...
</VirtualHost>


You may want one URL to be the official name though (e.g. http://www.mainsite.com with mainsite.com being a redirect to the other)
Set up the official site in one host and create another to do the redirects.

Code:
<VirtualHost *:80>
    ServerName http://www.mainsite.com
    ...rest of the config...
</VirtualHost>
 
<VirtualHost *:80>
    ServerName mainsite.com
    Redirect permanent / http://www.mainsite.com/
</VirtualHost>

Duplicate these two hosts for secondary.com.


Top
   
PostPosted: Sat Oct 20, 2012 4:00 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
zunzun wrote:
The names seemed chosen to more clearly illustrate the problem rather than hide anything.


There are sooooo many things that depend on the details for everything to work - using generic names removes all of those details from the troubleshooting process.

Personally, I have better things to do then second guess whats wrong, when if all the details were given, the answer would most likely be quick to find and obvious.

Websites (unless they require some type of authenticion) are PUBLIC by nature. So hiding them from the people on this forum (a very very very very tiny fraction of the Internet in general) is not only paranoid to the extreme, but counter productive to getting their problem solved.

But feel free to waste your time ZunZun playing twenty questions - whatever floats your boat, et al.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group