-1

Hi I am facing a problem when I go to my website at http://example.com it works, but if I go to http://www.example.com, I get 403 Forbidden on the page.

I did my research online and found a solution telling me to add in a new Entry (www. A record with IP Address) on my DNS Zone but it still did not work.

Any idea what might be the problem and how to solve it?

1 Answers1

1

First, you should be sure that you can resolve www.example.com. When you ping www.example.com, does it resolve the same IP address as example.com?

If the resolve for both are to the same address, the issue is more than likely host header related. If you are running IIS, open IIS Manager and expand your sites. Right click the site for example.com and select "Edit Bindings". Locate the entry that is resolving on port 80 and edit the entry. If the "Host Name" is empty, type in www.example.com and save the settings.

If the host name is not empty, select to add another entry. Type in port 80 for the port and enter in the hostname www.example.com.

If you are running Apache, check your apache configuration for the host. It should look something like the below example. ServerAlias would be the important part to add to your configuration.

<VirtualHost *:80>
DocumentRoot /var/www/example.com/
ServerName example.com
ServerAlias www.example.com
<Directory "/var/www/example.com/">
  allow from all
  Options None
  Require all granted
</Directory>
</VirtualHost>
Kevin Hayashi
  • 166
  • 1
  • 3