Archive for Code

Word Press Title Tag Optimization

Here a quick tip to help you optimise your Word Press title tag so that it becomes more search engine friendly.

  1. Login to your site using your favourite ftp application.

  2. Open the header.php file, it can be found in root > wp-content > themes > your theme.

  3. Find: <title><?php bloginfo(’name’); ?><?php wp_title(); ?></title>

  4. Replace with  : <title><?php wp_title(); ?><?php bloginfo(’name’); ?></title>

  5. Upload header.php back to your site

What this small change does is make your post title appear before your site name in the search engine results pages (SERPS). 

So instead of :

My WordPress Site - This is my latest Keyword Rich Blog Entry Title

You will now get:

This is my Latest Keyword Rich Blog Entry Title - My WordPress Site.

What you’ve effectively done is put your keyword targets closer to the beggining of the title tag, this is beneficial from an SEO perspective.

If you have any questions ask away…

Comments

Permanent (301) Redirects - Managing the Google Index

Have you heard of 301 (permanent) redirects?  If you haven’t let me explain what they are to you.

A 301 redirect is a tool available at your disposal as a webmaster that allows you to manage your indexed pages within the major search engines including Google.

Let me give you an example:

1- You have decided to change your url structure by removing the file extensions such as “.php”, “.html” etc… and you want to delete the old pages so that you do not have a duplicate content issue.  If you don’t perform a 301 redirect from the old URLs to the new ones then you’ll be faced with these issues:

  •  Your old pages indexed by Google will point to pages that no longer exists

  •  Sites who have linked to you in the past will now be linking to pages that do not exist

  • All the link popularity you’ve acquired over the years will no longer there.

So what do you do to avoid all that? … You 301 the old URLs to the new ones using the following methods depending on the server technology you’re using:

IIS Redirect

  • In internet services manager, right click on the file or folder you wish to redirect

  • Select the radio titled “a redirection to a URL”.

  • Enter the redirection page

  • Check “The exact url entered above” and the “A permanent redirection for this resource”

  • Click on ‘Apply’

ColdFusion Redirect

<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”http://www.new-url.com”>

PHP Redirect

<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.new-url.com” );
?>

ASP Redirect

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.new-url.com/”);
%>

ASP .NET Redirect

<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.new-url.com”);
}
</script>

JSP (Java) Redirect

<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.new-url.com/” );
response.setHeader( “Connection”, “close” );
%>

CGI PERL Redirect

$q = new CGI;
print $q->redirect(”http://www.new-url.com/”);

Ruby on Rails Redirect

def old_action
headers[”Status”] = “301 Moved Permanently”
redirect_to “http://www.new-url.com/”
end

Redirect Old domain to New domain (htaccess redirect)

Create a .htaccess file and insert in it the code below.  The .htaccess file needs to be placed in the root directory of your  site.

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newurl .com/$1 [R=301,L]

REPLACE http://www.newurl.com/ in the above code with theactual url you want to redirect .

Note* This redirection method only works on Linux-based servers with the Apache Mod-Rewrite module enabled.

Benefit of 301 Redirects

By performing a 301 redirect you are in effect telling Google et al to disregard your old urls and to replace them with the new ones.  In time Google will remove all the old URLs from it index and replace them (along with their link popularity) with the new ones …  et voila!

 N.B  You can also perform a 302 (temporary) redirect in the same methods mentioned above however 302 redirects are rarely used and I personally think they just server to confuse the search engines.

Good luck with your redirection and if you have any questions please feel free to ask here.

Comments

Structure of an HTML page

Comments

To Validate or not to Validate

To Validate or not to Validate…That is the question.

Does your HTML code validate? … But first, do you know what valid HTML means?

Let me start by explaining what Valid HTML means.

google w3c validation resultsValidating HTML documents (web documents)  is conforming them to the W3C HTML and XHTML standards.

So what is the W3C you may ask.  The W3C is the main international standards organization for the World Wide Web (W3). Its main job is the development of standards for the world wide web but it also undertakes educational and outreach programs and develops software as well as serve as an open forum for discussions about the Web.

So back to my original question … to validate or not to validate?

I personally think that it is good practice to have valid html documents as per the following 7 reasons to have valid HTML code:

1. Web Site Accessibility
2. Search engine friendly pages
3. Faster Loading
4. Less load on servers
5. Easier to update and maintain web site
6. Browser compatibility
7. Access more visitors

However, is it crucial to have valid HTML code in order to rank?

I say no, and Matt Cutts from Google agrees with me:


To stress my point, I did an HTML validation test on each of the 3 main search engines’ home pages; Google, Yahoo and MSN and here are the results:

Google: 51 errors
Yahoo: 34 errors
MSN: They actually pass!

Bottom line… Validate if you can and know how to but if you don’t or don’t know how to don’t lose sleep over it, you will still rank.

Comments

Next entries »

Add to Technorati Favorites