search
top

To WWW or not, part 2

In my previous article entitled “To WWW or not and how to redirect your blog“, I wrote about a neat plugin for WordPress users that allow you to specify the URL redirection. If your not familiar with this process, let me take a moment to describe why I use it.

When I first registered this domain name, it was registered without the www portion in front of it, so that when someone visits ejcross.com they come upon my site. The one issue that I became aware of while monitoring site statistics was that people were also using www.ejcross.com to get to this site. This got me curious about whether there was any search engine optimization problems that this would create.

What I found out

While there are and can be some problems with using a site that doesn’t have a WWW in the domain name, there is also confusion and lots of discussion about whether or not it affects a sites page ranking.

The problem lies in the fact that people still assume that to gain access to a site, you still have to put a WWW into the site url. This is not the case, and more and more sites are not using the WWW in their name. While there are sites that still use it, there are sites that don’t. This is an argument that I won’t go into, whether or not to use WWW. However, I hope to offer some advice on how to correct your sites redirection in the instances of when someone types in WWW or not, depending on how your site is set up. So, I hope that I can clarify some of the information.

NOTE: It appears that WordPress version 2.3 does this automatically, and takes care of this issue for you. If you have version 2.3, then don’t worry so much about this, but double check it to be sure.

What type of redirection is best?

There are generally two types of redirection that we will look at. One is a 301 redirection, which is known as a permanent redirection. A 301 redirect is good for search engine optimization. If you are looking to redirect your site, specifically to define if you are using a WWW or not, this is what you want.

The reason you want a 301 redirect is because when a page is served to a browser or search engine spider, if it sees a 301 redirect, it recognizes it to be permanent. It will index this fact and continue on about its merry way.

The second type of redirect is a 302 redirect. This is considered a temporary redirect, and can cause problems with search engine optimization. The reason this can cause problems is when the search engine spiders see a temporary redirect, it still saves the old url location in the index of the search engine along with the new “temporary” one. If your site was set up with a www.domain.com url, and you have used a 302 redirect to change it to a domain.com location, it still sees both.

For this reason, a 301 permanent redirect, is the best method to solve the duplicate content problem with the search engines.

Redirect by Plugin

WordPress has several plugins available, each with their own capabilities. The one that I am using on my site, and several others that I manage, is the WWW Redirect WordPress Plugin by Justin Shattuck.

The great feature of this plugin is that you just drop it in, activate it, and set two parameters. That is all you have to do for your 301 redirect (that’s the good one). The parameters allow you to determine if you want the WWW in your url, or not. The second parameter allows you the option of showing the “/index.php” on the end of your main site page.

Here are a plugin that helps to define issues encountered with the trailing “/” issue:

Permalink Redirect WordPress Plugin

I haven’t played around with this one, so I’m not sure how useful it really would be, but if you have issues with the trailing “/”, such as index.php/ , then this plugin might be worth looking into.

By .htaccess file

Another method of completing a 301 redirect is by modifying your .htaccess file. Not everyone has direct access to this file, but if you do and a plugin won’t work for you, this might be the best way for you to accomplish the task.

NOTE: Your server must have the MOD_REWRITE function turned on for this to work!

To redirect from http://domain.com to a http://www.domain.com just open your .htaccess file and place this into it:

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

To redirect from http://www.domain.com to http://domain.com then you would add this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

Of course, you would want to change the “domain.com” to reflect your own site url. Your .htaccess file would look something like this:

# BEGIN WordPress


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

# END WordPress

Your .htaccess file might, or might not be different. This sample is based upon a default wordpress installation. Errors in the .htaccess file can, and often will, cause your site to not be available, or even crash. When in doubt, check with your hosting service. I claim no special knowledge about using the .htaccess file, so please check with your host if you need support on how to do this.

By hosting

There are numerous other methods that are available on your host through various settings that can be configured and changed. Research what your host can do for you through their help files, or configuration settings. Always be sure to back up your site and test it completely to ensure that your site is working as you expect.

Remember also that Google is your friend with this. Each site and host is unique, and what might work for one site might not work with yours.

I hope this helps to clarify a little more about the WWW or not issue. What are your suggestions or what has worked for you?

Leave a Reply

Your email address will not be published. Required fields are marked *

top