0

I am using AWS EC2 and I am redirecting example.com domain to a directory in EC2 with the following virtual host:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com *.example.com
<IfModule mod_rewrite.c>
    RewriteEngine on
    # WITH 'www.'
    RewriteCond %{HTTP_HOST} !^www.(.*) [nocase]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [redirect=permanent,nocase,last]
  </IfModule>
DocumentRoot /var/www/html/Example
</VirtualHost>

Now it when I go to www.example.com it is working correctly. However, using the naked domain http://example.com I get the following error:

Failed to load resource: the server responded with a status of 404 (Not Found)
GET http://peep.ie/ net::ERR_NAME_NOT_RESOLVED

This is the DNS configuration:

A   *.example.com.  xxx.yyy.zzz.ttt 3600    Manual   Active  Yes
4

*.example.com covers all subdomains of example.com, but not example.com itself. You need a second DNS record.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.