11 May
Implementation of SEO Friendly URLs With PHP – Part 1
Just about all the information you can read on Search Engine Optimization (SEO) with regard to urls being SEO friendly includes discussions on using them, however if you are not using a Content Management System (CMS) to implement them, you may be doing yourself more harm than good. This two-part article discusses how to implement SEO urls in your website if you are building your site from the ground up. Part 1 discusses the rational behind the article and Part -2 walks through an example of a webpage that lists news articles and shows individual articles within the site utilizing SEO friendly URLS. It also discusses the .htaccess file changes that would need to be made to ensure there is only one version of the url availble to web browsers and automatic robots.
The genisis of this article is that one of our clients had a well established website where they were generating dynamic pages in PHP which also generated a sitemap and submitted it to their Google Webmaster account upon change. The sitemap contained well over 1000 URLs and was correctly read in Google Webmasters as having the correct number of submitted URLs, however Google Webmasters showed only 200 files in the Index for that sitemap. This of course conflicted with any site search on Google Search which showed results of over 1000! So Google Search knew about over 1000 pages, but was not attributing them to being the links in the sitemap, a definate head scratcher!
In examining their implementation it was determined that the client had taken a short cut in implenting their list of news articles. Instead of printing out links to individual articles in the SEO friendly manner, their URLs were pointing to a non-SEO friendly page. The links on their page pointed to:
http://www.example.com/news.php?article_id=2
instead of:
http://www.example.com/news/this-is-a-fantastic-article/
However, the sitemap contained the second version.
The problem with this is that Google has robots that crawl the site to find content in addtion to any sitemaps that are provided. By using the first version on their site, Google searched the site and found the non-SEO friendly version. They created duplicate content in the search engine’s eyes by having two urls that pointed to the exact same content and through the mystery that is Google’s back end processing, selected the unintended version. What they really needed to do is be consistent and use the second version everywhere they have a link to that article, which is sometimes can be easier said than done. You must ensure that your content always uses the SEO friendly URL (RSS feeds, backlinks, internal links, etc.) that way you will not get penalized for duplicate content.
In this instance we changed the URLs sitewide and made them all use the SEO friendly version and the client was able to increase their Indexed URL count from the sitemap to a number much closer to the number of URLs submitted in the Google Webmaster Tools.
In Part 2 of this article, we will implement a database driven news feed that generates and utilizes SEO friendly URLs for a website.

Respond to this post