amansoni211
amansoni211

Reputation: 929

AWS hosted website not working with non-www. But working fine with www

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]

Upvotes: 0

Views: 762

Answers (1)

Rodrigo Murillo
Rodrigo Murillo

Reputation: 13638

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

Upvotes: 1

Related Questions