How to prefix www to your website using htaccess

I was wondering why my new website was not showing www infront of my website name. Even when I search my website through Google and click on the link, there was no www infront of my website name in the URL address bar. This will lead to some bad SEO problems in the future. So, I did a search and found that a small change in the htaccess file can sortout this problem. If you are also facing the same problem, edit your htaccess file. It will be in your www folder in your host server. Edit it and insert the following.

# Make all requests have the www. in them
RewriteEngine on
RewriteCond %{HTTP_HOST} ^websitename\.com
RewriteRule ^(.*)$ http://www.websitename.com/$1 [R=permanent,L]

The # sign indicates that it is a comment. You should also modify the “websitename” string with your actual website name. For example if your website name is shellfish.com then you it should look like

# Make all requests have the www. in them
RewriteEngine on
RewriteCond %{HTTP_HOST} ^shellfish\.com
RewriteRule ^(.*)$ http://www.shellfish.com/$1 [R=permanent,L]

Hope this will be helpful and I will be sharing what I discover through this blog “What I learned Today”

WordPress .htaccess issue resolved

.htaccess wordpress issue resolved

htaccess issue with WordPress

I was trying to figure out how to work with this wordpress blog for my new website. It gave me an htaccess issue when I change a permalinks. After I changed the permalinks, I couldn’t see the individual blog posts. It was throwing a 404 error. I am pretty sure I will figure out how to update the .htaccess file but unfortunately that day is not today. As I did not  have the patience and as I just started building my blog, I decided to get rid of the complete blog and start all over again. I couldn’t even figure out the location of htaccess file. I have to get some serious web admin knowledge before I get this thing going.