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
84104
  • 12,905
  • 6
  • 45
  • 76
Arturo
  • 423
  • 3
  • 6
  • 20

1 Answers1

4

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

ceejayoz
  • 32,910
  • 7
  • 82
  • 106