SEO friendly URLs

  • biggie
  • Novice
  • Novice
  • biggie
  • Posts: 18
  • Loc: UK

Post 3+ Months Ago

Hi all,

I am developing an online shop and struggling to construct SEO friendly links.

I currently have a products.php page which depending upon the id passed in the url returns a different list of products from the database:

http://www.myshopsite.com/products.php?id=21

The shopper then selects a specific product from the list which passes another variable to the items.php page:

http://www.myshopsite.com/items.php?productid=56


I want to use mode_rewrite and .htaccess to rewrite these urls to something like:


http://www.myshopsite.com/products/Pens/Parker-Pens


Is this possible and how would i go about doing this? Ive searched many .htaccess tutorials but i am still unclear if i am structuring my links correctly?

thanks for help with this.

Dan
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • NagudNasorum
  • Born
  • Born
  • NagudNasorum
  • Posts: 3
  • Loc: Iasi

Post 3+ Months Ago

Code: [ Select ]
<IfModule mod_rewrite.c>
 
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
 
    RewriteCond %{REQUEST_URI} !-f
    RewriteCond %{REQUEST_URI} !-d
    RewriteCond %{REQUEST_URI} !-s
 
    RewriteRule ^products/([^/]+)/([^/]+)/([0-9])/?$   /products.php?id=$3 [L]
</IfModule>
  1. <IfModule mod_rewrite.c>
  2.  
  3.     Options +FollowSymLinks
  4.     RewriteEngine on
  5.     RewriteBase /
  6.  
  7.     RewriteCond %{REQUEST_URI} !-f
  8.     RewriteCond %{REQUEST_URI} !-d
  9.     RewriteCond %{REQUEST_URI} !-s
  10.  
  11.     RewriteRule ^products/([^/]+)/([^/]+)/([0-9])/?$   /products.php?id=$3 [L]
  12. </IfModule>


And you can access you like like that: http://example.com/products/Pens/Parker-Pens/56/ (where 56 is the product ID)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 74 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.