Edmonds Commerce Logo
  • home
    • blog
  • ecommerce
    • product catalogue
    • order processing
    • customer services
    • stock control
    • human resources
    • management information
  • development
    • oscommerce
    • php
    • mysql
    • open source
    • performance tuning
  • design
  • marketing
  • contact us
    • pricing

Edmonds Commerce Blog

Freelance PHP Ecommerce and SEO Developer in the UK

Latest Posts

Git Ignore All Files Except PHP etc + Solution
PHP 5.3 Is Released
Netbeans 6.7 is Out. Yay :-)
RGBA Cross Browser Support + Solution

Most Popular Posts

Magento Developer UK Freelance osCommerce UK Magento UK Developers on Linked.in CRE Loaded UK

Apache, mod_rewrite and SEO

March 4th, 2008
Read More apache, mod_rewrite, search engine optimisation

Dynamic database driven web sites tend to use various GET variables to define which content to display on that particular page. This is perfectly normal and reasonable. However it does make things a little confusing for search engine spiders as not every GET variable pertains to alternative content. Often GET is used for session, or maybe referrer tracking - or pretty much any piece of information which your web site may use.

This can mean that your product page about fluffy banana shaped teddy bears has the address

PLAIN TEXT
CODE:
  1. mysite.com/index.php?cat=123&product=333&breadcrumb=123_43_2&session_id=89o7324kjhlef8y234h

Not only does this make life difficult for search engine spiders, but its not exactly the most memorable url for your visitors either.

There is a solution and its called mod_rewrite.

Apache is part of the LAMP stack which is one of the most popular software and operating system combinations used to power web servers. Mod_rewrite is a particular plugin for Apache which allows you to create rules which will rewrite urls when they meet specific criteria.

The only really tricky part about setting up rewrite rules is that by neccessity they rely on regular expressions. Regular expressions can seem like a dark art at first, and often even for a seasoned coder familiar with a bit of regex, decoding someone elses expression can take a bit of brain power to say the least!

However there is no real reason to worry as all you really need to do is to learn how to achieve what you want. You do not need to learn the ins and outs of every particular regex function or operator.

For example take this

PLAIN TEXT
CODE:
  1. RewriteEngine On
  2.  
  3. RewriteRule ^(.*)\.p(.*).html$ product.php?products_id=$2&%{QUERY_STRING} [L]

This rewrite rule will take a url in the form of:
mysite.com/whatever-you-want-here.p.[products_id].html

And automatically convert it so that to your web system it is the url:
mysite.com/product.php?products_id=[products_id]

All you need to do now is devise a nice way of dynamically generating all of those nice keyword rich urls for your product pages and you are in business.

If you want any help enabling the power of mod_rewrite to give your web site properly search engine friendly URLS, get in touch today.

Related Blogs
http://www.crazyleafdesign.com/blog/check-if-mod_rewrite-is-activated-on-your-server/
http://www.jtpratt.com/2008/01/22/how-to-fix-htaccess-file-for-mod_rewrite-and-addhandler-on-godaddy-subdomain/
http://pensae.com/2008/01/14/when-mod_rewrite-doesnt-work/
http://www.logon2.com.au/blog/archive/web-design/php-apache-mod-rewrite-tutorial/
http://blogs.ittoolbox.com/c/codesharp/archives/when-bugs-become-features-22068
http://geniustechblog.com/htaccess-mod_rewrite-tutorials-developer-tools/
http://jeremyhermanns.org/2006/09/30/learning-to-use-mod_rewrite/

Possibly Relevant Posts:

  • no matches

Feed | Respond | Trackback

Leave a Reply

  • RSS Feed
  • Categories

    • apache
    • barcode
    • business
    • creloaded
    • css
    • curl
    • customer services
    • debugging
    • eclipse
    • ecommerce
    • edmondscommerce
    • email
    • excel
    • firefox
    • flash
    • gd
    • git
    • graphs
    • hosting
    • icecat
    • internet news
    • javascript
    • link building
    • linux
    • mac
    • magento
    • management
    • misc
    • mod_rewrite
    • mysql
    • open suse
    • oscommerce
    • php
    • plesk
    • portfolio
    • product catalogue
    • product feed
    • programming
    • regular expressions
    • ria
    • scraping
    • search engine optimisation
    • security
    • seo
    • spidering
    • twitter
    • ubuntu
    • Uncategorized
    • usability
    • vps
    • web design
    • web development
    • Windows
    • xampp
    • zend framework
    • zip
  • Archives

    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
  • Tags

    alpha browser case creloaded css curl development directories filezilla firefox flush google googlecheckout hosts file html internet explorer jaunty links linux magento migration mod_security mysql myths oscommerce php plesk reciprocal linking rgba search engine optimisation seo spidering spotify ssl synchronisation table transparency ubuntu uk virtualbox web web design xml zend form zend framework
  • Random Posts

    • Google Checkout, 501 Error with Mod Security + Solution
    • PHP and Zip Files
    • Online Business Tools
    • PHP Generated SQL
    • Magento Natively Supports Google Website Optimizer
    • PHP : Dead Easy Excel Export
    • osCommerce Essential Modifications
    • Regular Expression Test Tool
    • PHP Class for Facebook
    • SSH / Command Line Mysql Dump and Compress
  • Most Popular Posts

    • MySQL Copy Table from One Database to Another (15)
    • PHP Email Attachment Function (10)
    • PHP Save Images Using cURL (6)
    • PHP, cURL, CURLOPT FOLLOWLOCATION and open basedir Or Safe Mode (6)
    • Magento Sites Go Down if Magentocommerce.com Goes Down (6)
  • Recent Comments

    • admin on Migrate Magento to Alternative Server
    • jon on Migrate Magento to Alternative Server
    • admin on Magento Sites Go Down if Magentocommerce.com Goes Down
    • Sam on Magento Sites Go Down if Magentocommerce.com Goes Down
    • Email Attachments with PHP | S-Carter.co.uk on PHP Email Attachment Function

Edmonds Commerce related questions? Send us a message or call us on 0844 357 0201.

Freelance PHP Web Design UK Commercial Web Design