Web Services
  Home arrow Web Services arrow Page 3 - Make Dynamic URLs Search Engine Friendly
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
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? 
WEB SERVICES

Make Dynamic URLs Search Engine Friendly
By: Peter Lavin
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 53
    2004-03-01

    Table of Contents:
  • Make Dynamic URLs Search Engine Friendly
  • Check Your Server
  • Create an .htaccess File
  • Upload .htaccess to Your Server
  • Test the Results
  • Modifying Your Code
  • Conclusion

  • 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


    Make Dynamic URLs Search Engine Friendly - Create an .htaccess File


    (Page 3 of 7 )

    Open the source code of a page on your site and find an URL with a query string similar to the following:

    http://www.mysite/main.php?category=$category&subject=$subject

    If your URL is relative, rather than absolute, change it to an absolute URL and then copy it to the clipboard. You will have a much clearer understanding of what’s happening if you do it this way. Now open your browser and go to webmaster-toolkit.com.

    [Editor's note: A great resource for Search Engine Optimization techniques and tools can be found at http://www.seochat.com.]

    Take a moment to appreciate what is available here. I’m sure you’ll want to return, so bookmark the site.

    On the left, under the “SEO Tools” heading find and click the link “Rewrite Rule Generator”. Scroll down until your screen looks like this:

    Make Dynamic URLs Search Engine Friendly

    Now paste your dynamic URL into the appropriate textbox and decide if you want to represent your dynamic URL as a page or a directory. It’s up to you but make sure that you don’t create a directory name that matches an existing directory and that you don’t generate a page name that is longer than 255 characters. If you choose to generate a page name set the appropriate radio button and enter a page name into the textbox (something that best describes your page). We will be using the page name style of static URL in our examples. Click the generate button and you should have your .htaccess file in seconds. Copy the returned text area and paste it into your favorite text editor. The text returned when entering the word “type” into the page named textbox and using our example URL,

    http://www.mysite/main.php?category=$category&subject=$subject

    is as follows:


    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase 
    /
    RewriteRule type
    (.*)-(.*).htm$ /main.php?category=$1&subject=$2

    This is all you will need for your .htaccess file. This file will intercept all page requests within the directory in which it is located and convert specified URLs with a static format to ones using a query string. That may sound like the opposite of what you want to achieve. Read on and things will become clearer.

    As promised, you’ve now created a .htaccess file without any reference to regular expressions. Don’t leave the webmaster-toolkit site just yet. Have a look at what the rewritten URL should be. Our example looks like this:

    http://www.mysite.com/type\$category-\$subject.htm

    Copy it into a text file, remove the backslashes that precede each dollar sign and save it to a text file called format.txt. You’ll need this when revising your PHP scripts.

    More Web Services Articles
    More By Peter Lavin


       · i tried everything but i still couldnt get it.look my site is...
       · I have implemented the it as described above. However it is not displaying data...
       · I have implemented the it as described above. However it is not displaying data...
       · This blog states that making your dynamic URLs look static will help with SEO -...
       · i have a domain like...
     

    WEB SERVICES ARTICLES

    - Dealing with Loose Coupling in a Service-Ori...
    - Loose Coupling in a Service-Oriented Archite...
    - Safety, Idempotence, and the Resource-Orient...
    - The Resource-Oriented Architecture in Action
    - Features of the Resource-Oriented Architectu...
    - The Resource-Oriented Architecture
    - Getting Started with Flex
    - Automated Billing and Faxing for the Web
    - An Introduction to Web Services
    - The Foundations of Web Services: From Novice...
    - Web Services Reengineering: Finishing Touches
    - Fault Handling with Web Services
    - Flow and Web Services
    - Process Lifecycles and Web Services
    - Business Processes and Web Services







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek