my wordpress site works fine with “www.” but when I delete “www” it redirects me to localhost , I tried with .htacess but didn't work
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ example.com/$1 [L,R=301]
please help