Point a second domain name at the same website.

Hi,

I have both a .com and a .net domain name. The main domain is the .com but I'd like anyone typing the .net name to reach the same website.

I have set up a second domain zone for the .net address and the A record is pointing to the server's ip.

I'm running apache on debian.

Would I need to create a second virtual host file that points to the .com public space to get this to work? I've tried but to no avail.

What's the best way to go about this?

Cheers!

2 Replies

Ah nevermind, Apache hadn't restarted correctly.

The only thing now is that I want the .net to forward/change to the .com when loaded.

What's the best way to do this? (Is there a better way than using an htaccess file?)

Thanks again :)

No need for a second virtual host; just add a ServerAlias directive to the existing virtual host

eg

 <virtualhost *:80="">ServerName www.example.com
  ServerAlias www.example.net
  ServerAlias www.example.org</virtualhost> 

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