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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.