Apache redirect non-www URL

Let’s talk about how to resolve a problem that connecting to abc.com doesn’t work. What you get is 404 not found message.

What we want?
We want to be able to connect to www.abc.com when the user connects to abc.com

What is the problem?
The problem may be:

  1. DNS setting error. You have to check the DNS setting of the “abc.com” and make sure “abc.com” can be resolved to an IP address.
  2. Apache configuration
    Configure a virtual host to redirect the path.

    <VirtualHost abc.com:80>
        ServerName abc.com
        Redirect permanent / http://www.abc.com/


Leave a Reply

Your email address will not be published.