Jump to content


Photo

RewriteRule regex beginners question


  • Please log in to reply
No replies to this topic

#1 bander

bander
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 23 August 2006 - 09:44 AM

Hallo,

Want to use RewriteRules for SEO friendly URLs, but I need a little bit help with it. I exactly know what end result I want but how to do it is something else;)

It's about the following (ugly) URL

www.domain.com/?lang=tr&path=products/telephone/mobiel/samsung&item=1 (or with end slash in URL)

to make it better readable for you:

www.domain.com/ ?lang=tr& path=products/telephone/mobiel/samsung & item=1 (or with end slash in URL)



With a RewriteRule I should have the following URL:

www.domain.com/tr/products/telephone/mobiel/samsung/1 (or with end slash in URL)



In PHP I should catch the following $_GET's

$_GET['lang'] value stored: "tr"
$_GET['path'] value stored: "products/telephone/mobiel/samsung"
$_GET['item'] value stored: "1"


A condition is that the parameterlength behind the &path.... is dynamic generated, so this can be 0 to more.
The following example (Bold) obliges that 4 parameter is given in order to rewrite

RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/ /?lang=$1&path=$2/$3/$4/$5&item=$6

Can anybody help me with a practical example? I thank you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users