Hey there,
i'm beginner programmer in PHP and try on my web add cool url.
I've this simple rewrite rule that make from url page.com/index.php?id=about this url page.com/about

RewriteEngine on
RewriteRule ^(adm|img|content)/(.*)$ $1/$2 [L]
RewriteRule ^(.*)$    index.php?id=$1 [L,QSA]

But now i wanna to try some harder, e.g. i've this url address:
page.com/index.php?id=produkty&idk=sport&idv=football&idp=donovan
And I'm trying in url address to get: page.com/sport/football/donovan
(or similarly e.g. page.com/index.php?id=produkty&idk=sport -> page.com/sport)

I'm edited rewrite rules follows:

RewriteEngine on
RewriteRule ^(adm|img|content)/(.*)$ $1/$2 [L]
RewriteRule ^(.*)$    index.php?id=$1 [L,QSA]
RewriteRule ^(.*)$    index.php?id=$1&idk=$2&idv=$3&idp=$4 [L,QSA]

But i got wrong result :/ The rule isn't works..

I readed a lot tutorials on this problems, but this example i can't to get.
If is here some great person, which help me with this code, i will to be very glad, Thanks.

Manny

Recommended Answers

All 3 Replies

RewriteRule ^index\.php?id=(.*?)&idk=(.*?)&idv=(.*?)&idp=(.*?)$ $2/$3/$4 [L]

This one should work, given all the parameters are there, in that order. Hope this will get you started.

There is a problem with rewrite rules . Then there is one syntax can be used to solve that problem there are lots of parameters can be used for the these rules . For these you have to read the tutorials regarding these rules .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.