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?
-
1This 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.– closetnocCommented May 21, 2017 at 1:00
-
On apache virtual server?– Cain NukeCommented May 21, 2017 at 1:08
-
1See my example configurations in this answer. webmasters.stackexchange.com/questions/83316/…– closetnocCommented May 21, 2017 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 NukeCommented May 21, 2017 at 4:02
-
1When 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!!– closetnocCommented May 21, 2017 at 5:14
|
Show 1 more comment
1 Answer
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? Commented May 21, 2017 at 1:41
-
2Michael, 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.– SteveCommented May 21, 2017 at 2:23