0

My domain is with godaddy and files are hosted on aws.

website properly working with www.mydomain.abc, but giving error with mydomain.abc

How can I redirect www.mydomain.abc to mydomain.abc

using these redirect rules in .htaccess

    RewriteCond %{HTTP_HOST} !^www\.mydomain\.abc
    RewriteRule (.*) http://www.mydomain.abc/$1 [R=301,L]
amansoni211
  • 889
  • 2
  • 13
  • 30

1 Answers1

1

Make sure you have an alias to www from the root domain in your zone:

@ IN A 172.17.2.0
www IN CNAME @

To confirm this, ping both 'www.example.com' and 'example.com' and confirm they return the same address.

Update: I corrected the answer per Michael SQL Bot comment below

Rodrigo Murillo
  • 13,080
  • 2
  • 29
  • 50
  • That might appear to work, but it's wrong. A CNAME at the root violates the constraint that no other record can coexist at the same level as a CNAME, which means your NS and SOA records are invalid and the entire zone is not as it should be. This is why Route 53 created A-record alises -- they don't violate the constraint. – Michael - sqlbot Jun 14 '16 at 22:00