Why can I visit my own site: http://www.example.com
but not http://example.com
, which gives me
HTTP Error 403 (Forbidden): The server refused to fulfill the request
How do it fix it?
I wrote the site and upload to remote server.
mickburkejnr is close, but not entirely right. The problem is not with DNS (it could be, but that's unlikely). The problem is that your web server isn't configured to respond to queries for your site without the "www" prefix with the appropriate site.
Keep in mind that "www" is just a normal subdomain. "google.com" is the root site, "www.google.com" is a subdomain, just like "mail.google.com" is. If you wanted "mail.google.com" and "google.com" to go to the same place, then you'd have tell your webserver that.
Generally, the best solution is to redirect from "www" to the non-www version of the site (some prefer the other way; as you can see, SE sites don't). You can find examples of how to do that with common webservers easily using Google.
With Apache, I like to simply use the redirect directive in a separate virtual host:
<VirtualHost *:80>
Server www.domain.com
Redirect permanent / domain.com
</VirtualHost>
You DNS record isn't set up to accept traffic to the server without the www
. This is a simple A record, and all it will contain is either a blank space or "my0wnsite.com".
If you can't change the DNS records yourself, contact either your registrar or your hosting company and they will sort this out fairly quickly for you.
Tom's diagnosis is correct. I will offer another server configuration which serves a slightly different function than Tom's:
<VirtualHost *:80>
ServerName domain.com
DocumentRoot /var/www/domain
ServerAlias www.domain.com
</VirtualHost>
Tom's configuration will cause the server to redirect www.example.com to example.com and then serve content, whereas the above configuration will serve the same content without redirecting.
example.com
domain in questions.