Forum Moderators: phranque
i want to rewrite
http://www.example.com/index.php?akcija=vesti&do=izlistaj&kat=music&podkatid=rock
to
www.example.com/music/rock/
and
www.example.com/index.php?akcija=kategorija&kat=music
to
www.example.com/music/
when i do this
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_string} (.*)
RewriteRule ^([^.]*)/$ index.php?akcija=kategorija&kat=$1&%1[L]
RewriteRule ^([^.]*)/$ index.php?akcija=kategorija&kat=$1[L]
this works www.example.com/music/
but when i add
RewriteRule ^([^.]*)/$ index.php?akcija=vesti&do=izlistaj&kat=$1&podkatid=$2&%1[L]
RewriteRule ^([^.]*)/$ index.php?akcija=vesti&do=izlistaj&kat=$1&podkatid=$2[L]
it don't work, can you help me, i tryed several posts but no result
[edited by: jdMorgan at 2:25 pm (utc) on Sep. 13, 2007]
[edit reason] example.com [/edit]
RewriteRule ^([^/.]+)/?$ /index.php?akcija=vesti&do=izlistaj&kat=$1&podkatid=rock [L]
RewriteRule ^([^/]+)/([^/.]+)/?$ /index.php?akcija=vesti&do=izlistaj&kat=$1&podkatid=$2 [L]
Jim
i have this
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_string} (.*)
RewriteRule ^([^.]*)/$ index.php?akcija=kategorija&kat=$1&%1[L]
RewriteRule ^([^.]*)/$ index.php?akcija=kategorija&kat=$1[L]
RewriteRule ^([^/]+)/([^/.]+)/?$ /index.php?akcija=vesti&do=izlistaj&kat=$1&podkatid=$2 [L]
------------------
when i try this
www.example.com/music/ ->this works
www.example.com/music/rock/ ->not working
it is opening index.php?akcija=vesti&do=izlistaj&kat=$1&podkatid=$2
but when i print kat i get "index.php" insted of "music"
The third rule will never be invoked.
Comment-out the first two rules, and test the third rule. It should work.
And please notice that I posted one rule that will replace the first two current rules above. It is not necessary to "copy" the query string manually as you have done in your first rule; If you do not change the query string, it will pass through mod_rewrite unmodified.
Jim