Use Descriptive URLs to Bolster Your Search Engine Rankings!

Dynamically generated pages, such as those made by PHP scripts, usually have URLs that aren't very readable, like "mysite.com/script.php'id=3951&page=2". The URL doesn't say anything at all as to what the page is, other than showing that it's generated by a script. If you want to make your dynamic pages more search engine friendly, rewrite your scripts to use descriptive URLs!

A URL like "mysite.com/blogpost/3951-People-Know-What-This-Is.html" would be a lot better, wouldn't it? Right off the bat, you know what the page is about. If you're scrolling through your recent pages, you can find exactly what you're looking for a lot easier. More importantly though, search engines love URLs like these, so you get a nice rankings boost!

As a PHP programmer, I'm going to detail this technique with PHP, but the same principle applies to whatever serverside scripting language you use.

To start, have the script execute as a file without the extension, instead of with the .php extension (or or .jsp, or whatever extension your language uses). On Apache servers, you can use a ForceType statement in the .htaccess file to make the script execute as application/x-httpd-php. This tells Apache to run the file as a script instead of just spitting out your code.

Right now, your script should work properly as "mysite.com/script'id=3951&page=2". It's no longer readily apparent which language your site uses, but you can still tell that it's a dynamic page. Let's fix that next, by using PHP's explode function to break up the argument list. Using this, the arguments to your script will look like folders on your server instead of parameters to a script:

$args = explode("/",$_SERVER['PHP_SELF']);

Now, if you were to access "mysite.com/script/3951/2", $args would become an array with "3951" and "2". You can replace the slash with a hyphen to separate arguments without making them look like directory entries, or use a second explode statement to break down some of the arguments in a different way.

Finally, write some code that converts the title of the content (be it the blog post name, forum topic, etc.) into an argument, substituting dashes for spaces. Some people use underscores instead of dashes, but the search engines don't see underscored words as separate terms, so you end up with the search engine thinking "This_Is_My_Post" is one big word.

Add a pinch of code at the top of the script to make ensure that the URL matches the one you want it to be (so it redirects thread/4614-wrong-name-1 to thread/4614-This-is-my-posts-name-1), then add .html to the end of it (so it looks like an innocent html file) and you're good to go!

To prevent stuffing the url with words that don't really matter, use the string replace functions to remove words such as "I", "The", and "And" from the URL.

Most search engines won't completely index your website if it's all stuffed into argument lists, so by having URLs that look like normal filenames you both ensure that all of your pages are indexed and increase your search engine optimization. Making your URLs readable by humans is juts an added bonus. Make sure to update the links within your site to reflect your new URLs, so your page doesn't turn into a smattering of redirects.

Phil runs a web development resource site. Find yourself asking, Where do I buy web hosting? Read all about it on Phil's site!


Rate This Article:

This Site Is For Sale

Related Articles:

CorraTech Aligns with SpikeSource to Deliver Integrated Business-Ready Open Source Applications
CorraTech and SpikeSource form an alliance to deliver a fully supported, integrated suite of open source business management applications. The initial release of OpenSuite™ will include CRM and Enterprise Collaboration solutions.

UBmatrix to Open Source its Industry Leading XBRL Processing Engine
Intent on accelerating adoption of XBRL and making it a more fundamental piece of the enterprise IT fabric, UBmatrix to open its source code to developers on SourceForge.net

Saugatuck Study: Open Source Changes Software, While Software Changes Open Source
Research and analysis indicate that software prevalence has changed the nature of "open source"

MySQL AB & Carahsoft to Host a "Federal DBA Day" on January 24 for Oracle Database Users in the U.S. Government & Other Organizations
Free-of-Charge Technical Event in Washington, DC Follows Sold-Out Oracle Boot Camps in NYC & San Francisco

Sun Enhances MySQL Enterprise With New Query Analyzer Tool to Boost Database Application Performance : Paid Subscription Service Provides Enterprise
Sun Microsystems, Inc. (NASDAQ:JAVA) today announced a major new version of its MySQL Enterprise(TM) subscription service to help corporate users dramatically improve the speed and uptime of their MySQL(TM) database applications. MySQL Enterprise subscribers now have access to Sun's new MySQL Query Analyzer tool for monitoring query performance to accurately pinpoint and correct problem SQL code

Know Linux
Linux essentials:It's free for download but you have to pay a tiny bit to mail order it or buy it from a company. If you're getting Linux for more than 2-3 PCs, you can also get training and support at a small free, if you choose to have it.

Open Source Support Center Launches U.S. Headquarters
Europe's largest independent open source service and support company, credativ, is expanding its Open Source Support Center to the U.S. market to satisfy the rapidly growing need for expert assistance with open source technologies.

CorraTech Partners With Openbravo to Deliver Enterprise Class, Open Source ERP
Partnership brings CorraTech's implementation expertise to small and mid-size companies across the globe looking to leverage the value of open source software.

CorraTech Launches OPENSUITE, An Open Source Integration Project
New Open Source Project Will Enable Business Process and Data Integration Across Open Source Applications and with Larger IT Systems

KnowledgeTree Document Management Software Announces Adoption of GPL v3 Free and Open Source Software (FOSS) License
Adoption of OSI-approved GPL v3 License Strengthens Open Source Community Participation In Leading Open Source Document Management Project

Delivered Innovation Sponsors Saper Law Offices ‘Open Source Symposium’ In Chicago
Leading SaaS application developer (http://www.deliveredinnovation.com) Delivered Innovation to sponsor full day conference bringing members of the open source community together for detailed discussions involving the legal and intellectual property implications of producing or using open source software.

KnowledgeTree and CorraTech Partner to Provide Global Open Source Document Management Services
KnowledgeTree and CorraTech partner to promote popular open source document management software in North American and Western European markets.

Open Source Development
Open source applications are available absolutely for free, which is like a boon for the open source developers programmers, as with these open source applications, they can take over the open source development in the customized way for different businesses as per the requirements.

CorraTech Launches Outsourcing Solutions For Open Source Independent Software Vendors
Global, Open Source Software Services Firm Also Expands Operations in India

credativ Announces OpenLogic Partnership and Broadens Reach for Open Source Support
credativ, a global open source service and support company, announced today a partnership with OpenLogic, Inc., a provider of enterprise open source software solutions. Together the companies are able to offer credativ's in-depth third level support to OpenLogic's customers throughout Europe and North America.


Privacy Policy | Copyright/Trademark Notification