I had just installed my WordPress blog using my domain and noticed the "WWW" was gone. At first, I didn't mind this. It looked cleaner and neater on the url bar. Then I noticed that when I typed my domain with the "www" it didn't work.
I was getting an error that the site didn't exist. My site was there and did exist, but my site was missing the "www". I was concerned because "I knew how to get to my site, but were others going to have trouble?" Of course they would. They would not stop to think to drop the "www", they would only assume there was trouble with my site, or maybe even my site was down and out of commission. This could be devastating and cost many hits per day. I wanted to get it back and began research about how to do it. I contacted my host and there was a 24 hour wait in between emails. I didn't want to wait for them. Plus, I haven't heard from them in 2 days now, who knows how long this route will take.
I noticed there was not much info online to help with this so I determined to post how I did it.
My non-www site was/is http://fbckillarney.com
I wanted it to be back to http://www.fbckillarney.com
As I did the research online, I realized there were many who did not know how to care for this problem as well. Plus, having the www back in your name helps with the SEO purposes as well.
How to do it:
1. Log into your web hosting account.
2. Navigate to your database.
3. Locate your .htaccess file and click to edit (this will be different depending on who you are hosting with)
4. Add this code to the file, and don't change anything to the code:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domainname\.com$ [NC]
RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L]
5. Save changes.
6. Open new tab or window to test it out. Type your site address with "www" (http://www.yourdomain.com)included in the url. Test your site address "without www" (http://yourdomain.com)
It should work both ways now. The "www"address will take you to the site that will show the non www address in the address bar. Before it was giving you an error.
Hope this helps and hope you didn't have to search long to find this.
Enjoy!