Question

Unable to get www to redirect to non-www website

Posted December 2, 2013 2.2k views
I'm trying to redirect the site "www.spotbot.in" to site "spotbot.in", 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. hostmaster.Spotbot.in. ( 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 162.243.120.128 imagens CNAME go.domains.live.com. email CNAME go.domains.live.com. drive CNAME go.domains.live.com. calendario CNAME go.domains.live.com. www CNAME spotbot.in. RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.spotbot.in$ [NC] RewriteRule ^(.*)$ http://spotbot.in/$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.

×
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!
Submit an Answer