Tuesday, 20 July 2010

This tutorial explains how to use the .htaccess file to redirect all non-www requests to the www version of your domain. Visitors who thus type http://your-domain.com will automatically get redirected to http://www.your-domain.com.

The .htaccess file

You only need a regular text editor to create the .htaccess file, and, if you are using Windows, I recommend using Notepad as it is fast and if you want to edit your .htaccess file later, you can just drag your file onto Notepad to open it. Creating the .htaccess file is easy as it's merely a matter of typing in yor commands but people usually have problems saving the file with the correct name as Windows automatically adds the .txt extension at the end of the file whereas .htaccess's extension is technically htaccess itself with no file name.

To save your .htaccess file correctly, you thus need to save it by entering ".htaccess" in double quotes as shown below. By doing this, you are forcing Windows to use htaccess as the extension and the .htaccess file will be correctly saved.

Redirect non-www domains to www domains

Allowing your visitors to access both non-www and www versions of your website will lead search engines into believing that you have a lot of duplicate content, so it makes sense to redirect all non-www requests to your www domain.

These two lines will thus redirect all yourdomain.com requests to www.yourdomain.com, so that your web pages always available from only one URL.

One important thing to keep in mind is that you need to escape all periods in the RewriteCond line with a period. For example, in a .co.uk domain, your non-www redirection would look like the following:

Saturday, 17 July 2010

Images are going to be an inevitable part of your website, and it is important that you optimize them properly, just as you would do with your web pages. By properly optimizing your images, you ensure that your website is optimized for search engines and also increase the chances that your images will show up in search image results.

There are several things to take into consideration when optimizng your images:

Image nameNaming your image image1.jpg or 1343232.png is not going to be very helpful and is a sign of a poorly optimized (or not at all!) website. Image names are extremely important in search engine optimization, and it is essential that you give your image a relevant name that uses your keywords while describing the picture. For example, you could name your image puma-kids-sports-shoes.jpg for an image of some Puma shoes and if you're trying to target the terms "kids sports shoes" as part of your search engine optimization strategy.

It is important that you do not exaggerate when naming your images as search engines may flag your website if you go over the top and start naming your images "puma-nike-kid-sports-shoes-mens-sneakers-shoes.jpg". As such, I recommend sticking to four words in your image names when optimizing your website. Moreover, using a hyphen to separate your words enables search engine to interpret them as a single term, so using "search-engine-optimisation-images.jpg" is always better than just "seoimagenames.jpg" or "online_marketing_images_tutorials.jpg".

Image ALT attributeThe image ALT provides an alternative text for your image and is important both in search engine optimization and in accessibility considerations. Originally, the ALT attribute was simply used to provide a short description for an image in the event that an image would not load and to assist people unable to view the image, such as blind people or those with poor eyesight. However, with the emergence of everbody's favorite and most hated search engine Google, the image ALT attribute has grown to play an important role in search engine optimisation, and, along with image names, is one of the most important steps of optimizing your images for your website.

As with your images names, your image ALT should both include your keywords and describe the image, as shown below:

It is equally important to keep your images ALTs concise and to refrain from using 12-word image ALTs when optimizing your website as search engines can determine if you are trying to over-optimize website and will penalize you if you start including irrelevant ALTs in your images.

Image Title attributeThere has been some debate as to whether the Image Title attribute plays a part in search engine optimization. It does play a part, but primarily for images that are used as links. You may omit them for normal images, but they are necessary for any image that is being used to link to another page, such as a banner. Your image titles will also show up as a tooltip when you hover your mouse over the corresponding images, so they will be easily visible to your visitors.

As shown below, your title attribute should be concise and should always include your keywords:

Refrain from having similar image ALT and image Title attributes as you would just be inviting search engines to raise a flag wherever your website is concerned. While the image Title attribute has less impact on search engine rankings, it is nevertheless an integral part of search engine optimization.

Image Longdesc attributeI am only including this because I have seen people ask about the image longdesc attribute on many search engine optimization forums. However, the longdesc attribute plays absolutely no role in search engine optimization and should not form part of your SEO strategy. You're better not using it and instead investing that time on another part of your website.

Image sizeWith Google now including page load time in its algorithm, your image size will have a direct impact on how long it takes for your web page to load. Consequently, you must ensure that your images have a reasonable size. The PNG and JPEG formats are heavily favoured on the web for still images, and many websites nowadays favour the PNG format, as it offers smaller file sizes. The GIF format can be used for animated images.