: Access denied to visit a site without www 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
Why can I visit my own site: www.example.com but not 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.
More posts by @Lee4591628
3 Comments
Sorted by latest first Latest Oldest Best
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 domain.com </VirtualHost>
Tom's configuration will cause the server to redirect example.com to example.com and then serve content, whereas the above configuration will serve the same content without redirecting.
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 domain.com Redirect permanent / domain.com
</VirtualHost>
You DNS record isn't set up to accept traffic to the server without the 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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.