Mobile app version of vmapp.org
Login or Join
Lee4591628

: 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

@Lee4591628

Posted in: #403Forbidden #Dns #NoWww

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.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

3 Comments

Sorted by latest first Latest Oldest Best

 

@Nickens628

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.

10% popularity Vote Up Vote Down


 

@Yeniel560

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>

10% popularity Vote Up Vote Down


 

@Frith620

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme