Unable to get www to redirect to non-www website

Posted December 2, 2013 2.3k views
I'm trying to redirect the site "" to site "", but I'm not getting it performs. The site opens, but no redirect is done. Here are my dns zone file and my .htacess file $TTL 1800 @ IN SOA NS1.DIGITALOCEAN.COM. ( 1386026866 ; last update: 2013-12-02 23:27:46 UTC 3600 ; refresh 900 ; retry 1209600 ; expire 1800 ; ttl ) IN NS NS1.DIGITALOCEAN.COM. NS NS2.DIGITALOCEAN.COM. NS NS3.DIGITALOCEAN.COM. @ IN A imagens CNAME email CNAME drive CNAME calendario CNAME www CNAME RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^$ [NC] RewriteRule ^(.*)$$1 [R=301,L]

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers
In your Apache config file, what do you have listed for the ServerName and ServerAlias directives?
I'm not using a virtualhost. It's in the main apache folder /var/www
I got it. It was an BOM on the .htacess file. Removed the BOM and it worked like a charm.
Thank you guys!