Updating .htaccess for better SEO

Once in a while it’s best to check out things and see what’s new, especially things that related to our blog. I’ve just update my blog to the latest version of WordPress, so next I decided to check out .htaccess. It might not be something new but as long as it helps to improve my blog, it’s worth try it out. Below are few of the methods that I found out about .htaccess that is useful.

The first and most basic thing that we use .htaccess is to redirect non WWW to WWW. Take for example http://www.toasteggme.com and http://toasteggme.com, we want all the page rank juice and page indexed in just one address instead of two.

<code>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^toasteggme.com [NC]
RewriteRule ^(.*)$ http://www.toasteggme.com/$1 [L,R=301]
</code>

If you choose to redirect WWW to non WWW, here’s the way to do it. By the way you just have to write’ RewriteEngine On’ into the code once.

<code>
RewriteCond %{HTTP_HOST} ^www.toasteggme.com [NC]
RewriteRule ^(.*)$ http://toasteggme.com/$1 [L,R=301]
</code>

If you need to redirect dynamic URL’s with parameters to single static file, this is the code.

<code>
RewriteRule ^earnmoneysignup.jsp?id=(.*)$ /moneymaking.htm [L,R=301]
</code>

The dynamic URL http://www.toasteggme.com/earnmoneysignup.jsp?id=1234 will be redirected to http://www.toasteggme.com/moneymaking.htm

If you like to redirect all files from a folder to one single file, this is the code.

<code>
RewriteRule ^earnmoneyproducts(.*)$ /moneymaking.php [L,R=301]
</code>

All the requests to the folder /earnmoneyproducts will be redirect to /moneymaking.php

If you like to redirect viewers who received a 404 error to another page, this is the code.

ErrorDocument 404 /notfound.html

The benefit of having the above redirect is that viewers won’t get lost if they arrive to your website with an invalid URL.

Apart of trying to get the attention of search engines, we need to consider the usage of .htaccess towards the benefits of our readers. In my opinion the main function of .htaccess is redirect. I suppose we should direct our readers around our blog so that they won’t stuck at “page not found”. It is the work of keeping our blog in a more organized condition. After several years of blogging, we need to reorganize the old URLs to the new URLs. Some of the links or URL that we place several years before might expired or deleted.

There are some other .htaccess techniques that I did not mention. The above methods are the ones that I used for my blogs for SEO purposes. Feel free to check out the links below for further information.

The above information is taken and base on the reference from
.htaccess, 301 Redirects & SEO: Guest Post by NotSleepy | Seo Book.com
Basic .htaccess tricks for SEO and convenience | Blog | Econsultancy

Comments

comments

Both comments and pings are currently closed.

Comments are closed.