[Solved] 2 domains -> 1 site

I would like to point another domain to my http://houghton.co site.

The second domain is http://neilhoughton.com.

I have tried editing my VirtualHosts but so far I am unable to make this work. :?

Any help would be much appreciated.

EDIT: I think I fixed this.

If someone could confirm that this looks correct I will mark the post SOLVED.

/etc/apache2/sites-available/neilhoughton.com

ServerAdmin neilandjune@gmail.com

ServerName neilhoughton.com

ServerAlias www.neilhoughton.com

DocumentRoot /srv/www/houghton.co/public_html/

3 Replies

do you have a different virtualhost for houghton.com? if so, just add both of these to serveralias in that one. no need to have a separate vhost

@mrneilypops:

nano /etc
Huh?

So, based on your edit, it looks like you have two virtualhost entries, one for houghton.co and one for neilhoughton.com?

If they're redirecting to the exact same set of documents on your server, you only need one virtualhost declaration that would look something like this:

 <virtualhost *:80="">ServerAdmin neilandjune@gmail.com
ServerName houghton.co
ServerAlias www.houghton.co neilhoughton.com www.neilhoughton.com

DocumentRoot /srv/www/houghton.co/public_html/</virtualhost> 

I do this on one server of mine a lot, to park purchased domains to our company's home page until they are associated with their respective codebase.

Also, your VirtualHost line starts with the IP and port 80, as opposed to mine, which is *:80. Unless you have multiple IP addresses and need to explicitly make sure one site answers on one IP and another answers on another IP, either way works in your case.

I honestly don't know if there is a "best practices" way to do it, as I'm only a newbie to being a sysadmin. Everything I've learned is through Google, and Linode's documentation, so take my advice with a grain of salt, it may not be perfect :) All I know is that it works for me, and works well!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct