Search Optimization
  Home arrow Search Optimization arrow Page 3 - PHP Search Engine Optimization
SEO Chat Forums  
Choosing Keywords  
Google Optimization  
Link Trading  
MSN Optimization  
Search Engine News  
Search Engine Spiders  
Search Optimization  
Web Directories  
Website Marketing  
Website Promotion  
Website Submission  
Yahoo Optimization  
SEO Tools
Adsense Calculator
AdSense Preview
Advanced Meta-Tags
Alexa Rank Tool
Check Server Headers
Class C Checker
Code to Text Ratio
CPM Calculator
Domain Age Check
Domain Typos
Future PageRank
Google Dance
Google Keywords
Google Search
Google Suggest
Google vs Yahoo
Indexed Pages
Keyword Cloud
Keyword Density
Keyword Difficulty
Keyword Optimizer
Keyword Position
Keyword Typos
Link Popularity
Link Price Calculator
Meta Analyzer
Meta Tag Generator
Multiple Link Popularity
Page Comparison
Page Size
PageRank Lookup
PageRank Search
Robots.txt Generator
ROI Calculator 
S.E. Comparison 
S.E. Keyword Position 
Site Link Analyzer 
Spider Simulator 
URL Redirect Check 
URL Rewriting 
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
SEO Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SEARCH OPTIMIZATION

PHP Search Engine Optimization
By: Roger Stringer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 38
    2005-01-26

    Table of Contents:
  • PHP Search Engine Optimization
  • Session IDs
  • Mod_rewrite
  • ForceType

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    PHP Search Engine Optimization - Mod_rewrite


    (Page 3 of 4 )



    It's very important that you plan how to rewrite you URLs, because you don't want to go back and change the links over and over again. Once you have a good steady map of how to rewrite your links, you can go ahead and modify a test script to see if everything worked. If your links work properly then you'll be able to move on and modify all existing links. Let's take a look at this example below:

    http://example.com/index.php?act=articles&id=21&page=0

    That can turn into:

    mod_rewrite URL: http://example.com/articles/21/0.html

    Doesn't that look much friendlier?

    Once you have planned your URL rewriting, you are ready to set up your .htaccess file, which maps out what to do with each URL. Here's an example of what to put in your .htaccess file. I'll explain how this works below.

    RewriteEngine On
    RewriteRule ^(.*)/(.*)/(.*).html /index.php?act=$1&id=$2&page=$3

    In the example above we have two lines. The first line RewriteEngine On starts the mod_rewrite engine.


    The second line does all the work.

    RewriteRule ^(.*)/(.*)/(.*).html /index.php?act=$1&id=$2&page=$3

    Here you are starting a RewriteRule.

    RewriteRule ^(.*)/(.*)/(.*).html /index.php?act=$1&id=$2&page=$3

    This is the start of a regex that allows you to create wildcards for the URL that your friendly URL. This allows us to use whatever we want between the (.*) and compare them to the second part of this rewrite rule.

    RewriteRule ^(.*)/(.*)/(.*).html /index.php?act=$1&id=$2&page=$3

    This is the final part of the rewrite rule that tells us how to map the friendly URL in part two of the RewriteRule to the actual URL that our script was written for. mod_rewrite will translate part one to part 2 automatically.

    This works by using regex. The first (.*) will be $1 and the second (.*) becomes $2 in the translation. You can do this as many times as you want for your URL.

    Say for example we had this URL: articles/21/0.html.

    We'll be matching up /index.php?act=articles&id=31&page=0 by using mod_rewrite!

    Believe it or not, that's all that's really to mod_rewriting!

    You can really get carried away with this by adding category titles to some of your rewrite URLs to make them even more search engine friendly. All you have to do is create another regex and don't use that variable in your translation.

    More Search Optimization Articles
    More By Roger Stringer


       · Very usefull article. Thanks.other web articles (spanish) on...
       · Content management software has almost became a necessity for large content sites...
       · I've been looking at using this method and this approach seems to work for me....
       · not sure where you got that. But it's always been the style I showed you.Here's...
       · If we remove the session ID from the URL, what is the best way to maintain state...
       · If you remove it from the URL, then state is maintained transparently. The site...
       · Roger,I have the same question regarding session id, if you turn it off, customer...
       · yes, that's correct.I own quite a few sites, including sites with carts and I have...
       · The session is stored on the server, the user is sent a cookie referencing that...
       · This article is a joke, right?
       · This article is a joke, right?
       · Yes this article is joke, but only for jokers ;)By the way G R E A T E A R T I...
       · I think in the article it said drop the .htaccess file in your root. The example was...
       · Really useful.. Thanks!
     

    SEARCH OPTIMIZATION ARTICLES

    - Stumbling Blocks to Web Site Success
    - Web Pages to Include in Your Site
    - Big Sites Don`t Automatically Rule Search En...
    - You Need More Than One Site Map
    - The Whys and Hows of Video Search Optimizati...
    - An SEO`s Experience: 21 Rules for Performing...
    - An SEO Eyeful: Interview with Ronald Herskow...
    - Research Your Competition for SEO
    - How I Became Number 1
    - Popular SEO Myths
    - Meta Elements: A Field Guide
    - Optimize This Page Title
    - What to Consider When Hiring an SEO
    - Raising Your Visibility with LinkedIn
    - Optimize Your LinkedIn Profile





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway