I just finished setting up my server. Something is a little odd though. I have 2 domains (example.net and example.com) pointing to the same directory /var/www/html/forum. They both show right, except for one thing. www.example.net shows the apache test page and all other inner pages give a forbidden error. However, www.example.com works fine just as its counterpart without the WWW. Why is that? Whats wrong with the .net domain?

  • 1
    This is a common mistake. You have to set up the sites www.example.com and www.example.net too or use the ServerAlias directive within your config files. – closetnoc May 21 '17 at 1:00
  • On apache virtual server? – Cain Nuke May 21 '17 at 1:08
  • 1
    See my example configurations in this answer. webmasters.stackexchange.com/questions/83316/… – closetnoc May 21 '17 at 3:15
  • Thank you. Although the weird thing is that I didnt need to do that on my old server and not even on this one for example.com so im somewhat puzzled. – Cain Nuke May 21 '17 at 4:02
  • 1
    When a web server gets a request packet, it tries to match the request header to a site. If there is not a match, most simply return the first site. That is what was happening and likely happened before. Cheers!! – closetnoc May 21 '17 at 5:14

Make sure that you have added aliases for both names to your site. If you are using third-party DNS you will have to make sure that is properly set up as well.

  • You mean by creating a virtual host on apache web server? – Cain Nuke May 21 '17 at 1:41
  • 2
    Michael, welcome to Stack Exchange Pro Webmasters - your answer may be correct, but it isn't particularly useful. You seem knowledgable, help the OP by describing the steps to add an alias for the site and what they need in DNS. – Steve May 21 '17 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.