Jump to content

RewriteRule regex beginners question


bander

Recommended Posts

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&[b]path=$2/$3/$4/$5[/b]&item=$6

Can anybody help me with a practical example? I thank you.
Link to comment
https://forums.phpfreaks.com/topic/18395-rewriterule-regex-beginners-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.